"""
    Nomad Broker

    Make payments, and customs declaration for orders.  # noqa: E501

    The version of the OpenAPI document: 1.4.10
    Contact: manwei@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.payment_method import PaymentMethod
from nomad_broker_cli.model.profit_receiver_request import ProfitReceiverRequest
from nomad_broker_cli.model.profit_receiver_response import ProfitReceiverResponse
from nomad_broker_cli.model.profit_sharing_request import ProfitSharingRequest
from nomad_broker_cli.model.profit_sharing_response import ProfitSharingResponse


class ProfitApi(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 __delete_profit_receiver(
            self,
            merchant,
            type,
            **kwargs
        ):
            """DeleteProfitReceiver  # noqa: E501

            Delete a profit sharing receiver  # noqa: E501
            This method makes a synchronous HTTP request by default. To make an
            asynchronous HTTP request, please pass async_req=True

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

            Args:
                merchant (str): Merchant name to payment company, e.g. wechat.prod
                type (str): Receiver type of profit sharing. MERCHANT_ID: merchants, PERSONAL_OPENID: personal. PERSONAL_OPENID is not available

            Keyword Args:
                account (str): The receiver account.. [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:
                ProfitReceiverResponse
                    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['type'] = \
                type
            return self.call_with_http_info(**kwargs)

        self.delete_profit_receiver = Endpoint(
            settings={
                'response_type': (ProfitReceiverResponse,),
                'auth': [
                    'authorization'
                ],
                'endpoint_path': '/profit/receiver/{merchant}',
                'operation_id': 'delete_profit_receiver',
                'http_method': 'DELETE',
                'servers': None,
            },
            params_map={
                'all': [
                    'merchant',
                    'type',
                    'account',
                    'payment_method',
                ],
                'required': [
                    'merchant',
                    'type',
                ],
                'nullable': [
                ],
                'enum': [
                    'type',
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                    ('type',): {

                        "MERCHANT_ID": "MERCHANT_ID",
                        "PERSONAL_OPENID": "PERSONAL_OPENID"
                    },
                },
                'openapi_types': {
                    'merchant':
                        (str,),
                    'type':
                        (str,),
                    'account':
                        (str,),
                    'payment_method':
                        (PaymentMethod,),
                },
                'attribute_map': {
                    'merchant': 'merchant',
                    'type': 'type',
                    'account': 'account',
                    'payment_method': 'payment_method',
                },
                'location_map': {
                    'merchant': 'path',
                    'type': 'query',
                    'account': 'query',
                    'payment_method': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client,
            callable=__delete_profit_receiver
        )

        def __get_profit_sharing(
            self,
            merchant,
            out_order_no,
            transaction_id,
            **kwargs
        ):
            """GetProfitSharing  # noqa: E501

            Merchant query profit sharing 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_profit_sharing(merchant, out_order_no, transaction_id, async_req=True)
            >>> result = thread.get()

            Args:
                merchant (str): Merchant name to payment company, e.g. wechat.prod
                out_order_no (str): The profit sharing number of the merchant, shall be unique within merchant system
                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:
                ProfitSharingResponse
                    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_no'] = \
                out_order_no
            kwargs['transaction_id'] = \
                transaction_id
            return self.call_with_http_info(**kwargs)

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

        def __post_profit_receiver(
            self,
            merchant,
            **kwargs
        ):
            """PostProfitReceiver  # noqa: E501

            Create a profit sharing receiver  # 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_profit_receiver(merchant, async_req=True)
            >>> result = thread.get()

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

            Keyword Args:
                profit_receiver_request (ProfitReceiverRequest): [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:
                ProfitReceiverResponse
                    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_profit_receiver = Endpoint(
            settings={
                'response_type': (ProfitReceiverResponse,),
                'auth': [
                    'authorization'
                ],
                'endpoint_path': '/profit/receiver/{merchant}',
                'operation_id': 'post_profit_receiver',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'merchant',
                    'profit_receiver_request',
                ],
                'required': [
                    'merchant',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'merchant':
                        (str,),
                    'profit_receiver_request':
                        (ProfitReceiverRequest,),
                },
                'attribute_map': {
                    'merchant': 'merchant',
                },
                'location_map': {
                    'merchant': 'path',
                    'profit_receiver_request': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client,
            callable=__post_profit_receiver
        )

        def __post_profit_sharing(
            self,
            merchant,
            **kwargs
        ):
            """PostProfitSharing  # noqa: E501

            Create a profit sharing 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_profit_sharing(merchant, async_req=True)
            >>> result = thread.get()

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

            Keyword Args:
                profit_sharing_request (ProfitSharingRequest): [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:
                ProfitSharingResponse
                    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_profit_sharing = Endpoint(
            settings={
                'response_type': (ProfitSharingResponse,),
                'auth': [
                    'authorization'
                ],
                'endpoint_path': '/profit/sharing/{merchant}',
                'operation_id': 'post_profit_sharing',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'merchant',
                    'profit_sharing_request',
                ],
                'required': [
                    'merchant',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'merchant':
                        (str,),
                    'profit_sharing_request':
                        (ProfitSharingRequest,),
                },
                'attribute_map': {
                    'merchant': 'merchant',
                },
                'location_map': {
                    'merchant': 'path',
                    'profit_sharing_request': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client,
            callable=__post_profit_sharing
        )
