"""
    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.error_api_response import ErrorApiResponse
from nomad_broker_cli.model.payment_method import PaymentMethod
from nomad_broker_cli.model.payout_bill_request import PayoutBillRequest
from nomad_broker_cli.model.payout_request import PayoutRequest
from nomad_broker_cli.model.payout_response import PayoutResponse


class PayoutApi(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_abroad_payout(
            self,
            merchant,
            out_order_id,
            transaction_id,
            **kwargs
        ):
            """GetAbroadPayout  # noqa: E501

            Merchant query payout order infomation  # 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_abroad_payout(merchant, out_order_id, transaction_id, async_req=True)
            >>> result = thread.get()

            Args:
                merchant (str): Merchant name to payment company, e.g. wechat.prod
                out_order_id (str): The payout number of the merchant, shall be generated by the merchant when initiating the payout request
                transaction_id (str): Payment system internal order number

            Keyword Args:
                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:
                PayoutResponse
                    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['out_order_id'] = \
                out_order_id
            kwargs['transaction_id'] = \
                transaction_id
            return self.call_with_http_info(**kwargs)

        self.get_abroad_payout = Endpoint(
            settings={
                'response_type': (PayoutResponse,),
                'auth': [
                    'authorization'
                ],
                'endpoint_path': '/payout/abroad/{merchant}',
                'operation_id': 'get_abroad_payout',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'merchant',
                    'out_order_id',
                    'transaction_id',
                    'payment_method',
                ],
                'required': [
                    'merchant',
                    'out_order_id',
                    'transaction_id',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'merchant':
                        (str,),
                    'out_order_id':
                        (str,),
                    'transaction_id':
                        (str,),
                    'payment_method':
                        (PaymentMethod,),
                },
                'attribute_map': {
                    'merchant': 'merchant',
                    'out_order_id': 'out_order_id',
                    'transaction_id': 'transaction_id',
                    'payment_method': 'payment_method',
                },
                'location_map': {
                    'merchant': 'path',
                    'out_order_id': 'query',
                    'transaction_id': 'query',
                    'payment_method': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client,
            callable=__get_abroad_payout
        )

        def __get_abroad_payout_bill(
            self,
            merchant,
            bill_date,
            **kwargs
        ):
            """GetAbroadPayoutBill  # noqa: E501

            Download the payout bill  # 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_abroad_payout_bill(merchant, bill_date, async_req=True)
            >>> result = thread.get()

            Args:
                merchant (str): Merchant name to payment company, e.g. wechat.prod
                bill_date (str): Bill date. Query format YYYY-MM-DD, for example, 2021-01-01

            Keyword Args:
                merchant_id (str): Merchant ID of merchant.. [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:
                file_type
                    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['bill_date'] = \
                bill_date
            return self.call_with_http_info(**kwargs)

        self.get_abroad_payout_bill = Endpoint(
            settings={
                'response_type': (file_type,),
                'auth': [
                    'authorization'
                ],
                'endpoint_path': '/payout/bill/abroad/{merchant}',
                'operation_id': 'get_abroad_payout_bill',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'merchant',
                    'bill_date',
                    'merchant_id',
                    'payment_method',
                ],
                'required': [
                    'merchant',
                    'bill_date',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'merchant':
                        (str,),
                    'bill_date':
                        (str,),
                    'merchant_id':
                        (str,),
                    'payment_method':
                        (PaymentMethod,),
                },
                'attribute_map': {
                    'merchant': 'merchant',
                    'bill_date': 'bill_date',
                    'merchant_id': 'merchant_id',
                    'payment_method': 'payment_method',
                },
                'location_map': {
                    'merchant': 'path',
                    'bill_date': 'query',
                    'merchant_id': 'query',
                    'payment_method': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/octet-stream',
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client,
            callable=__get_abroad_payout_bill
        )

        def __post_abroad_payout(
            self,
            merchant,
            **kwargs
        ):
            """PostAbroadPayout  # noqa: E501

            Create a payout order  # 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_abroad_payout(merchant, async_req=True)
            >>> result = thread.get()

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

            Keyword Args:
                payout_request (PayoutRequest): [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:
                PayoutResponse
                    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_abroad_payout = Endpoint(
            settings={
                'response_type': (PayoutResponse,),
                'auth': [
                    'authorization'
                ],
                'endpoint_path': '/payout/abroad/{merchant}',
                'operation_id': 'post_abroad_payout',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'merchant',
                    'payout_request',
                ],
                'required': [
                    'merchant',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'merchant':
                        (str,),
                    'payout_request':
                        (PayoutRequest,),
                },
                'attribute_map': {
                    'merchant': 'merchant',
                },
                'location_map': {
                    'merchant': 'path',
                    'payout_request': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client,
            callable=__post_abroad_payout
        )

        def __post_abroad_payout_bill(
            self,
            merchant,
            **kwargs
        ):
            """PostAbroadPayoutBill  # noqa: E501

            Payout funds transactions operation  # 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_abroad_payout_bill(merchant, async_req=True)
            >>> result = thread.get()

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

            Keyword Args:
                payout_bill_request (PayoutBillRequest): [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:
                PayoutResponse
                    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_abroad_payout_bill = Endpoint(
            settings={
                'response_type': (PayoutResponse,),
                'auth': [
                    'authorization'
                ],
                'endpoint_path': '/payout/bill/abroad/{merchant}',
                'operation_id': 'post_abroad_payout_bill',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'merchant',
                    'payout_bill_request',
                ],
                'required': [
                    'merchant',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'merchant':
                        (str,),
                    'payout_bill_request':
                        (PayoutBillRequest,),
                },
                'attribute_map': {
                    'merchant': 'merchant',
                },
                'location_map': {
                    'merchant': 'path',
                    'payout_bill_request': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client,
            callable=__post_abroad_payout_bill
        )
