"""
    Nomad Broker

    Nomad payment provider aggregation, including make payments, and customs declaration for orders and etc.  # noqa: E501

    The version of the OpenAPI document: 1.5.1
    Contact: ben.song@samarkand.global
    Generated by: https://openapi-generator.tech
"""


import re  # noqa: F401
import sys  # noqa: F401

from nomad_broker_cli.api_client import ApiClient, Endpoint
from nomad_broker_cli.model_utils import (  # noqa: F401
    check_allowed_values,
    check_validations,
    date,
    datetime,
    file_type,
    none_type,
    validate_and_convert_types
)
from nomad_broker_cli.model.base_api_response import BaseApiResponse
from nomad_broker_cli.model.customs_code import CustomsCode
from nomad_broker_cli.model.customs_identification_request import CustomsIdentificationRequest
from nomad_broker_cli.model.customs_identification_response import CustomsIdentificationResponse
from nomad_broker_cli.model.customs_payment_redeclare_request import CustomsPaymentRedeclareRequest
from nomad_broker_cli.model.customs_payment_request import CustomsPaymentRequest
from nomad_broker_cli.model.customs_payment_response import CustomsPaymentResponse
from nomad_broker_cli.model.customs_payments_response import CustomsPaymentsResponse
from nomad_broker_cli.model.error_api_response import ErrorApiResponse
from nomad_broker_cli.model.payment_method import PaymentMethod


class CustomsApi(object):
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client

        def __get_customs_payment(
            self,
            merchant,
            customs,
            **kwargs
        ):
            """GetCustomsPayment  # noqa: E501

            Merchant queries customs clearance information by order number  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.get_customs_payment(merchant, customs, async_req=True)
            >>> result = thread.get()

            Args:
                merchant (str): Merchant name to payment company, e.g. wechat.prod
                customs (CustomsCode): Customs code, available options: GUANGZHOU_ZS, HANGZHOU_ZS, NINGBO, ZHENGZHOU_BS, CHONGQING, SHANGHAI_ZS, SHENZHEN, ZHENGZHOU_ZH_ZS

            Keyword Args:
                out_trade_no (str): The internal order number of the merchant system. [optional]
                transaction_id (str): Payment system internal order number. [optional]
                sub_order_no (str): The internal sub-order number of the merchant system. [optional]
                sub_order_id (str): The internal sub-order number of the payment company system. [optional]
                payment_method (PaymentMethod): Must be `wechatpay` or `alipay`. [optional]
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): timeout setting for this request. If one
                    number provided, it will be total request timeout. It can also
                    be a pair (tuple) of (connection, read) timeouts.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                CustomsPaymentsResponse
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['merchant'] = \
                merchant
            kwargs['customs'] = \
                customs
            return self.call_with_http_info(**kwargs)

        self.get_customs_payment = Endpoint(
            settings={
                'response_type': (CustomsPaymentsResponse,),
                'auth': [
                    'authorization'
                ],
                'endpoint_path': '/customs/payment/{merchant}',
                'operation_id': 'get_customs_payment',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'merchant',
                    'customs',
                    'out_trade_no',
                    'transaction_id',
                    'sub_order_no',
                    'sub_order_id',
                    'payment_method',
                ],
                'required': [
                    'merchant',
                    'customs',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'merchant':
                        (str,),
                    'customs':
                        (CustomsCode,),
                    'out_trade_no':
                        (str,),
                    'transaction_id':
                        (str,),
                    'sub_order_no':
                        (str,),
                    'sub_order_id':
                        (str,),
                    'payment_method':
                        (PaymentMethod,),
                },
                'attribute_map': {
                    'merchant': 'merchant',
                    'customs': 'customs',
                    'out_trade_no': 'out_trade_no',
                    'transaction_id': 'transaction_id',
                    'sub_order_no': 'sub_order_no',
                    'sub_order_id': 'sub_order_id',
                    'payment_method': 'payment_method',
                },
                'location_map': {
                    'merchant': 'path',
                    'customs': 'query',
                    'out_trade_no': 'query',
                    'transaction_id': 'query',
                    'sub_order_no': 'query',
                    'sub_order_id': 'query',
                    'payment_method': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client,
            callable=__get_customs_payment
        )

        def __post_customs_identification(
            self,
            merchant,
            **kwargs
        ):
            """PostCustomsIdentification  # noqa: E501

            Upload the payer identity information which will be re-verified by payment provider, supported payment method: wechatpay  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.post_customs_identification(merchant, async_req=True)
            >>> result = thread.get()

            Args:
                merchant (str): Merchant name to payment company, e.g. wechat.prod

            Keyword Args:
                customs_identification_request (CustomsIdentificationRequest): [optional]
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): timeout setting for this request. If one
                    number provided, it will be total request timeout. It can also
                    be a pair (tuple) of (connection, read) timeouts.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                CustomsIdentificationResponse
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['merchant'] = \
                merchant
            return self.call_with_http_info(**kwargs)

        self.post_customs_identification = Endpoint(
            settings={
                'response_type': (CustomsIdentificationResponse,),
                'auth': [
                    'authorization'
                ],
                'endpoint_path': '/customs/identification/{merchant}',
                'operation_id': 'post_customs_identification',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'merchant',
                    'customs_identification_request',
                ],
                'required': [
                    'merchant',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'merchant':
                        (str,),
                    'customs_identification_request':
                        (CustomsIdentificationRequest,),
                },
                'attribute_map': {
                    'merchant': 'merchant',
                },
                'location_map': {
                    'merchant': 'path',
                    'customs_identification_request': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client,
            callable=__post_customs_identification
        )

        def __post_customs_payment(
            self,
            merchant,
            **kwargs
        ):
            """PostCustomsPayment  # noqa: E501

            Declare an payment order to the customs  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.post_customs_payment(merchant, async_req=True)
            >>> result = thread.get()

            Args:
                merchant (str): Merchant name to payment company, e.g. wechat.prod

            Keyword Args:
                customs_payment_request (CustomsPaymentRequest): [optional]
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): timeout setting for this request. If one
                    number provided, it will be total request timeout. It can also
                    be a pair (tuple) of (connection, read) timeouts.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                CustomsPaymentResponse
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['merchant'] = \
                merchant
            return self.call_with_http_info(**kwargs)

        self.post_customs_payment = Endpoint(
            settings={
                'response_type': (CustomsPaymentResponse,),
                'auth': [
                    'authorization'
                ],
                'endpoint_path': '/customs/payment/{merchant}',
                'operation_id': 'post_customs_payment',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'merchant',
                    'customs_payment_request',
                ],
                'required': [
                    'merchant',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'merchant':
                        (str,),
                    'customs_payment_request':
                        (CustomsPaymentRequest,),
                },
                'attribute_map': {
                    'merchant': 'merchant',
                },
                'location_map': {
                    'merchant': 'path',
                    'customs_payment_request': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client,
            callable=__post_customs_payment
        )

        def __put_customs_payment(
            self,
            merchant,
            **kwargs
        ):
            """PutCustomsPayment  # noqa: E501

            Redeclare an payment order to the customs  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

            >>> thread = api.put_customs_payment(merchant, async_req=True)
            >>> result = thread.get()

            Args:
                merchant (str): Merchant name to payment company, e.g. wechat.prod

            Keyword Args:
                customs_payment_redeclare_request (CustomsPaymentRedeclareRequest): [optional]
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): timeout setting for this request. If one
                    number provided, it will be total request timeout. It can also
                    be a pair (tuple) of (connection, read) timeouts.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                CustomsPaymentResponse
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['merchant'] = \
                merchant
            return self.call_with_http_info(**kwargs)

        self.put_customs_payment = Endpoint(
            settings={
                'response_type': (CustomsPaymentResponse,),
                'auth': [
                    'authorization'
                ],
                'endpoint_path': '/customs/payment/{merchant}',
                'operation_id': 'put_customs_payment',
                'http_method': 'PUT',
                'servers': None,
            },
            params_map={
                'all': [
                    'merchant',
                    'customs_payment_redeclare_request',
                ],
                'required': [
                    'merchant',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'merchant':
                        (str,),
                    'customs_payment_redeclare_request':
                        (CustomsPaymentRedeclareRequest,),
                },
                'attribute_map': {
                    'merchant': 'merchant',
                },
                'location_map': {
                    'merchant': 'path',
                    'customs_payment_redeclare_request': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client,
            callable=__put_customs_payment
        )
