# coding: utf-8

"""
    Marketing API

    <p>The <i>Marketing API </i> offers two platforms that sellers can use to promote and advertise their products:</p> <ul><li><b>Promoted Listings</b> is an eBay ad service that lets sellers set up <i>ad campaigns </i> for the products they want to promote. eBay displays the ads in search results and in other marketing modules as <b>SPONSORED</b> listings. If an item in a Promoted Listings campaign sells, the seller is assessed a Promoted Listings fee, which is a seller-specified percentage applied to the sales price. For complete details, refer to the <a href=\"/api-docs/sell/static/marketing/pl-landing.html\">Promoted Listings playbook</a>.</li><li><b>Promotions Manager</b> gives sellers a way to offer discounts on specific items as a way to attract buyers to their inventory. Sellers can set up discounts (such as \"20% off\" and other types of offers) on specific items or on an entire customer order. To further attract buyers, eBay prominently displays promotion <i>teasers</i> throughout buyer flows. For complete details, see <a href=\"/api-docs/sell/static/marketing/promotions-manager.html\">Promotions Manager</a>.</li></ul>  <p><b>Marketing reports</b>, on both the Promoted Listings and Promotions Manager platforms, give sellers information that shows the effectiveness of their marketing strategies. The data gives sellers the ability to review and fine tune their marketing efforts.</p><p><b>Store Email Campaign</b> allows sellers to create and send email campaigns to customers who have signed up to receive their newsletter. For more information on email campaigns, see <a href=\"/api-docs/sell/static/marketing/store-email-campaigns.html#email-campain-types\" target=\"_blank\">Store Email Campaigns</a>.<p class=\"tablenote\"><b>Important!</b> Sellers must have an active eBay Store subscription, and they must accept the <b>Terms and Conditions</b> before they can make requests to these APIs in the Production environment. There are also site-specific listings requirements and restrictions associated with these marketing tools, as listed in the \"requirements and restrictions\" sections for <a href=\"/api-docs/sell/marketing/static/overview.html#PL-requirements\">Promoted Listings</a> and <a href=\"/api-docs/sell/marketing/static/overview.html#PM-requirements\">Promotions Manager</a>.</p> <p>The table below lists all the Marketing API calls grouped by resource.</p>  # noqa: E501

    OpenAPI spec version: v1.22.0
    
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from ...sell_marketing.api_client import ApiClient


class AdReportMetadataApi(object):
    """NOTE: This class is auto generated by the swagger code generator program.

    Do not edit the class manually.
    Ref: https://github.com/swagger-api/swagger-codegen
    """

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

    def get_report_metadata(self, **kwargs):  # noqa: E501
        """get_report_metadata  # noqa: E501

        This call retrieves information that details the fields used in each of the Promoted Listings reports. Use the returned information to configure the different types of Promoted Listings reports.</br></br> You can retrieve metadata for all report types,funding models and channels, or you can filter based on funding model and/or channel.<br/><br/><span class=\"tablenote\"><b>Note:</b> The reporting of some data related to sales and ad-fees may require a 72-hour (<b>maximum</b>) adjustment period which is often referred to as the <i>Reconciliation Period</i>. Such adjustment periods should, on average, be minimal. However, at any given time, the <b>payments</b> tab may be used to view those amounts that have actually been charged.</span>  # 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_report_metadata(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str funding_model: This query parameter is used only if the user wants to see report metadata for a specific funding model. Refer to the <a href=\"/api-docs/sell/marketing/types/pls:FundingModelEnum\">FundingModelEnum</a> type for supported values.
        :param str channel: This query parameter is used only if the user wants to see COST_PER_CLICK report metadata for a specific channel. Refer to the <a href=\"/api-docs/sell/marketing/types/pls:ChannelEnum\">ChannelEnum</a> type for supported values.<br><br><span class=\"tablenote\"><b>Note:</b> The channel parameter is only applicable for COST_PER_CLICK funding model.</span>
        :return: ReportMetadatas
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_report_metadata_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.get_report_metadata_with_http_info(**kwargs)  # noqa: E501
            return data

    def get_report_metadata_with_http_info(self, **kwargs):  # noqa: E501
        """get_report_metadata  # noqa: E501

        This call retrieves information that details the fields used in each of the Promoted Listings reports. Use the returned information to configure the different types of Promoted Listings reports.</br></br> You can retrieve metadata for all report types,funding models and channels, or you can filter based on funding model and/or channel.<br/><br/><span class=\"tablenote\"><b>Note:</b> The reporting of some data related to sales and ad-fees may require a 72-hour (<b>maximum</b>) adjustment period which is often referred to as the <i>Reconciliation Period</i>. Such adjustment periods should, on average, be minimal. However, at any given time, the <b>payments</b> tab may be used to view those amounts that have actually been charged.</span>  # 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_report_metadata_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str funding_model: This query parameter is used only if the user wants to see report metadata for a specific funding model. Refer to the <a href=\"/api-docs/sell/marketing/types/pls:FundingModelEnum\">FundingModelEnum</a> type for supported values.
        :param str channel: This query parameter is used only if the user wants to see COST_PER_CLICK report metadata for a specific channel. Refer to the <a href=\"/api-docs/sell/marketing/types/pls:ChannelEnum\">ChannelEnum</a> type for supported values.<br><br><span class=\"tablenote\"><b>Note:</b> The channel parameter is only applicable for COST_PER_CLICK funding model.</span>
        :return: ReportMetadatas
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['funding_model', 'channel']  # 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_report_metadata" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'funding_model' in params:
            query_params.append(('funding_model', params['funding_model']))  # noqa: E501
        if 'channel' in params:
            query_params.append(('channel', params['channel']))  # 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 = ['api_auth']  # noqa: E501

        return self.api_client.call_api(
            '/ad_report_metadata', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ReportMetadatas',  # 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)

    def get_report_metadata_for_report_type(self, report_type, **kwargs):  # noqa: E501
        """get_report_metadata_for_report_type  # noqa: E501

        This call retrieves metadata that details the fields used by a specific Promoted Listings report type. Use the <b>report_type</b> path parameter to indicate metadata to retrieve.<br/><br/>This method does not use a request payload.<br/><br/><span class=\"tablenote\"><b>Note:</b> The reporting of some data related to sales and ad-fees may require a 72-hour (<b>maximum</b>) adjustment period which is often referred to as the <i>Reconciliation Period</i>. Such adjustment periods should, on average, be minimal. However, at any given time, the <b>payments</b> tab may be used to view those amounts that have actually been charged.</span>  # 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_report_metadata_for_report_type(report_type, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str report_type: This path parameter specifies the name of the report type whose metadata you want to retrieve.<br /><br />For details about available report types and their descriptions, refer to the <a href=\"/api-docs/sell/marketing/types/plr:ReportTypeEnum\" target=\"_blank\">ReportTypeEnum</a>. (required)
        :param str funding_model: The funding model used in the report. The funding model must be compatible with the report type specified in the path parameter. Refer to the <a href=\"/api-docs/sell/marketing/types/pls:FundingModelEnum\">FundingModelEnum</a> type for supported values.
        :param str channel: The channel used in the report. The channel must be compatible with the report type specified in the path parameter. Refer to the <a href=\"/api-docs/sell/marketing/types/pls:ChannelEnum\">ChannelEnum</a> type for supported values. <br><br><span class=\"tablenote\"><b>Note:</b> The channel parameter is only applicable for COST_PER_CLICK funding model.</span>
        :return: ReportMetadata
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_report_metadata_for_report_type_with_http_info(report_type, **kwargs)  # noqa: E501
        else:
            (data) = self.get_report_metadata_for_report_type_with_http_info(report_type, **kwargs)  # noqa: E501
            return data

    def get_report_metadata_for_report_type_with_http_info(self, report_type, **kwargs):  # noqa: E501
        """get_report_metadata_for_report_type  # noqa: E501

        This call retrieves metadata that details the fields used by a specific Promoted Listings report type. Use the <b>report_type</b> path parameter to indicate metadata to retrieve.<br/><br/>This method does not use a request payload.<br/><br/><span class=\"tablenote\"><b>Note:</b> The reporting of some data related to sales and ad-fees may require a 72-hour (<b>maximum</b>) adjustment period which is often referred to as the <i>Reconciliation Period</i>. Such adjustment periods should, on average, be minimal. However, at any given time, the <b>payments</b> tab may be used to view those amounts that have actually been charged.</span>  # 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_report_metadata_for_report_type_with_http_info(report_type, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str report_type: This path parameter specifies the name of the report type whose metadata you want to retrieve.<br /><br />For details about available report types and their descriptions, refer to the <a href=\"/api-docs/sell/marketing/types/plr:ReportTypeEnum\" target=\"_blank\">ReportTypeEnum</a>. (required)
        :param str funding_model: The funding model used in the report. The funding model must be compatible with the report type specified in the path parameter. Refer to the <a href=\"/api-docs/sell/marketing/types/pls:FundingModelEnum\">FundingModelEnum</a> type for supported values.
        :param str channel: The channel used in the report. The channel must be compatible with the report type specified in the path parameter. Refer to the <a href=\"/api-docs/sell/marketing/types/pls:ChannelEnum\">ChannelEnum</a> type for supported values. <br><br><span class=\"tablenote\"><b>Note:</b> The channel parameter is only applicable for COST_PER_CLICK funding model.</span>
        :return: ReportMetadata
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['report_type', 'funding_model', 'channel']  # 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_report_metadata_for_report_type" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'report_type' is set
        if ('report_type' not in params or
                params['report_type'] is None):
            raise ValueError("Missing the required parameter `report_type` when calling `get_report_metadata_for_report_type`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'report_type' in params:
            path_params['report_type'] = params['report_type']  # noqa: E501

        query_params = []
        if 'funding_model' in params:
            query_params.append(('funding_model', params['funding_model']))  # noqa: E501
        if 'channel' in params:
            query_params.append(('channel', params['channel']))  # 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 = ['api_auth']  # noqa: E501

        return self.api_client.call_api(
            '/ad_report_metadata/{report_type}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ReportMetadata',  # 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)
