# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# See https://github.com/eolymp/contracts/tree/main/cmd/protoc-gen-python-esdk for more details.
"""Generated protocol buffer code."""

import urllib.parse
from google.protobuf import symbol_database as _symbol_database

_sym_db = _symbol_database.Default()


class InvoiceServiceClient:
    def __init__(self, transport, url="https://api.eolymp.com"):
        self.transport = transport
        self.url = url

    def ListInvoices(self, request, **kwargs):
        path = "/vendor/invoices"

        return self.transport.request(
            method="GET",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.vendor.ListInvoicesOutput"),
            **kwargs,
        )

    def DescribeInvoice(self, request, **kwargs):
        path = "/vendor/invoices/"+urllib.parse.quote(request.invoice_id)

        # Cleanup URL parameters to avoid any ambiguity
        request.invoice_id = ""

        return self.transport.request(
            method="GET",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.vendor.DescribeInvoiceOutput"),
            **kwargs,
        )

    def CreateInvoice(self, request, **kwargs):
        path = "/vendor/invoices"

        return self.transport.request(
            method="POST",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.vendor.CreateInvoiceOutput"),
            **kwargs,
        )

    def UpdateInvoice(self, request, **kwargs):
        path = "/vendor/invoices/"+urllib.parse.quote(request.invoice_id)

        # Cleanup URL parameters to avoid any ambiguity
        request.invoice_id = ""

        return self.transport.request(
            method="PUT",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.vendor.UpdateInvoiceOutput"),
            **kwargs,
        )

    def DeleteInvoice(self, request, **kwargs):
        path = "/vendor/invoices/"+urllib.parse.quote(request.invoice_id)

        # Cleanup URL parameters to avoid any ambiguity
        request.invoice_id = ""

        return self.transport.request(
            method="DELETE",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.vendor.DeleteInvoiceOutput"),
            **kwargs,
        )

    def UploadInvoiceDocument(self, request, **kwargs):
        path = "/vendor/invoices/"+urllib.parse.quote(request.invoice_id)+"/document"

        # Cleanup URL parameters to avoid any ambiguity
        request.invoice_id = ""

        return self.transport.request(
            method="POST",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.vendor.UploadInvoiceDocumentOutput"),
            **kwargs,
        )

    def SubmitInvoice(self, request, **kwargs):
        path = "/vendor/invoices/"+urllib.parse.quote(request.invoice_id)+"/submit"

        # Cleanup URL parameters to avoid any ambiguity
        request.invoice_id = ""

        return self.transport.request(
            method="POST",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.vendor.SubmitInvoiceOutput"),
            **kwargs,
        )

    def ApproveInvoice(self, request, **kwargs):
        path = "/vendor/invoices/"+urllib.parse.quote(request.invoice_id)+"/approve"

        # Cleanup URL parameters to avoid any ambiguity
        request.invoice_id = ""

        return self.transport.request(
            method="POST",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.vendor.ApproveInvoiceOutput"),
            **kwargs,
        )

    def RejectInvoice(self, request, **kwargs):
        path = "/vendor/invoices/"+urllib.parse.quote(request.invoice_id)+"/reject"

        # Cleanup URL parameters to avoid any ambiguity
        request.invoice_id = ""

        return self.transport.request(
            method="POST",
            url=self.url+path,
            request_data=request,
            response_symbol=_sym_db.GetSymbol("eolymp.vendor.RejectInvoiceOutput"),
            **kwargs,
        )

