# coding: utf-8

"""
    The Selling Partner API for Amazon Seller Wallet Open Banking API Spec.  For more information, refer to the [Seller Wallet Open Banking API Use Case Guide](doc:seller-wallet-open-banking-api-v2024-03-01-use-case-guide).

    The Selling Partner API for Seller Wallet (Seller Wallet API) provides financial information that is relevant to a seller's Seller Wallet account. You can obtain financial events, balances, and transfer schedules for Seller Wallet accounts. You can also schedule and initiate transactions.

    The version of the OpenAPI document: 2024-03-01
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from spapi.api_client import ApiClient


class TransferPreviewApi(object):
    """NOTE: This class is auto generated by the openapi generator.

    Do not edit the class manually.
    """

    api_models_module = "spapi.models.seller_wallet_2024_03_01"

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

    def get_transfer_preview(self, source_country_code, source_currency_code, destination_country_code, destination_currency_code, base_amount, marketplace_id, **kwargs):  # noqa: E501
        """Fetch potential fees that could be applied on a transaction on the basis of the source and destination country currency code  # noqa: E501

        Returns list of potential fees on a transaction based on the source and destination country currency code  # 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_transfer_preview(source_country_code, source_currency_code, destination_country_code, destination_currency_code, base_amount, marketplace_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str source_country_code: Represents 2 character country code of source transaction account in ISO 3166 standard format. (required)
        :param str source_currency_code: Represents 3 letter currency code in ISO 4217 standard format of the source transaction country. (required)
        :param str destination_country_code: Represents 2 character country code of destination transaction account in ISO 3166 standard format. (required)
        :param str destination_currency_code: Represents 3 letter currency code in ISO 4217 standard format of the destination transaction country. (required)
        :param float base_amount: Represents the base transaction amount without any markup fees, rates that will be used to get the transfer preview. (required)
        :param str marketplace_id: The marketplace for which items are returned. The marketplace ID is the globally unique identifier of a marketplace. To find the ID for your marketplace, refer to [Marketplace IDs](https://developer-docs.amazon.com/sp-api/docs/marketplace-ids). (required)
        :return: TransferRatePreview
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_transfer_preview_with_http_info(source_country_code, source_currency_code, destination_country_code, destination_currency_code, base_amount, marketplace_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_transfer_preview_with_http_info(source_country_code, source_currency_code, destination_country_code, destination_currency_code, base_amount, marketplace_id, **kwargs)  # noqa: E501
            return data

    def get_transfer_preview_with_http_info(self, source_country_code, source_currency_code, destination_country_code, destination_currency_code, base_amount, marketplace_id, **kwargs):  # noqa: E501
        """Fetch potential fees that could be applied on a transaction on the basis of the source and destination country currency code  # noqa: E501

        Returns list of potential fees on a transaction based on the source and destination country currency code  # 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_transfer_preview_with_http_info(source_country_code, source_currency_code, destination_country_code, destination_currency_code, base_amount, marketplace_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str source_country_code: Represents 2 character country code of source transaction account in ISO 3166 standard format. (required)
        :param str source_currency_code: Represents 3 letter currency code in ISO 4217 standard format of the source transaction country. (required)
        :param str destination_country_code: Represents 2 character country code of destination transaction account in ISO 3166 standard format. (required)
        :param str destination_currency_code: Represents 3 letter currency code in ISO 4217 standard format of the destination transaction country. (required)
        :param float base_amount: Represents the base transaction amount without any markup fees, rates that will be used to get the transfer preview. (required)
        :param str marketplace_id: The marketplace for which items are returned. The marketplace ID is the globally unique identifier of a marketplace. To find the ID for your marketplace, refer to [Marketplace IDs](https://developer-docs.amazon.com/sp-api/docs/marketplace-ids). (required)
        :return: TransferRatePreview
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['source_country_code', 'source_currency_code', 'destination_country_code', 'destination_currency_code', 'base_amount', 'marketplace_id']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_transfer_preview" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'source_country_code' is set
        if self.api_client.client_side_validation and ('source_country_code' not in params or
                                                       params['source_country_code'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `source_country_code` when calling `get_transfer_preview`")  # noqa: E501
        # verify the required parameter 'source_currency_code' is set
        if self.api_client.client_side_validation and ('source_currency_code' not in params or
                                                       params['source_currency_code'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `source_currency_code` when calling `get_transfer_preview`")  # noqa: E501
        # verify the required parameter 'destination_country_code' is set
        if self.api_client.client_side_validation and ('destination_country_code' not in params or
                                                       params['destination_country_code'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `destination_country_code` when calling `get_transfer_preview`")  # noqa: E501
        # verify the required parameter 'destination_currency_code' is set
        if self.api_client.client_side_validation and ('destination_currency_code' not in params or
                                                       params['destination_currency_code'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `destination_currency_code` when calling `get_transfer_preview`")  # noqa: E501
        # verify the required parameter 'base_amount' is set
        if self.api_client.client_side_validation and ('base_amount' not in params or
                                                       params['base_amount'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `base_amount` when calling `get_transfer_preview`")  # noqa: E501
        # verify the required parameter 'marketplace_id' is set
        if self.api_client.client_side_validation and ('marketplace_id' not in params or
                                                       params['marketplace_id'] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `marketplace_id` when calling `get_transfer_preview`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'source_country_code' in params:
            query_params.append(('sourceCountryCode', params['source_country_code']))  # noqa: E501
        if 'source_currency_code' in params:
            query_params.append(('sourceCurrencyCode', params['source_currency_code']))  # noqa: E501
        if 'destination_country_code' in params:
            query_params.append(('destinationCountryCode', params['destination_country_code']))  # noqa: E501
        if 'destination_currency_code' in params:
            query_params.append(('destinationCurrencyCode', params['destination_currency_code']))  # noqa: E501
        if 'base_amount' in params:
            query_params.append(('baseAmount', params['base_amount']))  # noqa: E501
        if 'marketplace_id' in params:
            query_params.append(('marketplaceId', params['marketplace_id']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/finances/transfers/wallet/2024-03-01/transferPreview', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='TransferRatePreview',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats, api_models_module=self.api_models_module)
