# -*- coding: utf-8 -*-

"""
shelldatareportingapis

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from shelldatareportingapis.api_helper import APIHelper
from shelldatareportingapis.models.accounts import Accounts


class InvoiceSummaryRequestFilters(object):

    """Implementation of the 'InvoiceSummaryRequestFilters' model.

    TODO: type model description here.

    Attributes:
        col_co_id (int): Collecting Company Id of the selected payer.  
            Optional.  Example:  1-Philippines  5-UK
        payer_id (int): Payer Id of the selected payer. Optional if
            PayerNumber is passed else Mandatory Example: 123456
        payer_number (str): Payer Number of the selected payer. Optional if
            PayerId is passed else Mandatory Example: GB000000123
        invoice_id (int): Invoice id.  Optional.   This input is a search
            criterion, if given.  Example: 1
        invoice_number (str): Invoice number.  Optional.  This input is a
            search criterion, if given.   Example: 0123456789
        from_date (str): Invoice date searched from this date. Optional. This
            input is a search criterion, if given. Date format: yyyyMMdd
            Example: 20170830 Note: This criterion is ignored if ‘Period’ is
            given. Also, this criterion is ignored if ‘ToDate’ is not provided.
        to_date (str): Invoice date searched until this date.  Optional.  This
            input is a search criterion, if given.  Date format: yyyyMMdd 
            Example: 20170830   Note: This criterion is ignored if ‘Period’ is
            given.   Also, this criterion is ignored if ‘FromDate’ is not
            provided.
        invoice_date (str): Date of invoicing.  Optional.  This input is a
            search criterion, if given.   Date format: yyyyMMdd  Example:
            20170830
        summary_document_id (int): Summary document id Optional. This input is
            a search criterion, if given. Example: 1
        summary_document_number (str): Summary document number Optional. This
            input is a search criterion, if given. Example:
            ‘0/CZ0000000123456/2017’
        statement_of_account_id (str): Statement of Account Id of the payment
            customer.   Optional.  This input is a search criterion, if given.
            Example: 1
        so_a_reference_number (str): Statement of Account reference number of
            the payment customer.   Optional.  This input is a search
            criterion, if given.  Example: 123
        period (int): Invoice date search period. Valid values – 1.    Last 7
            days – Issued in last 7 days. 2.    Last 30 days – Issued in last
            30 days. 3.    Last 90 days – Issued in last 90 days. Optional.
            This input is a search criterion, if given. Example: 1
        invoice_status (str): Status of the invoice. Valid values – •    Due –
            Invoices due for payment and is within the due date. •    Paid –
            Fully paid Invoices. •    Overdue – Invoices due of payment and
            has crossed the due date. •    CreditNote – Credit notes •   
            CreditStatement Optional. This input is a search criterion, if
            given.
        invoiced_on_behalf_of (str): ISO code of the country i.e., UK, DE, MY,
            etc. Optional
        include_e_invoice_details (bool): Whether to include the additional
            invoice details in the API response.   Optional. Default value
            “False”.  The parameters that are populated   •   
            DocumentReference  •    AdditionalDocuments   The above fields
            will not be present in the response when the respective data is
            not available in the source system.
        col_co_code (int): Collecting Company Code of the selected payer.  
            Mandatory - It is mandatory field to external source ATOS for
            E-invoicing.   Example:  86-Philippines  5-UK
        accounts (List[Accounts]): TODO: type description here.
        mtype (str): Invoice type. Allowed values – •    Original – Original
            document. •    Reversal – Reversed document. •    Replacement –
            Replaced document. Optional. (When not passed all invoice, types
            are considered for search) This input is a search criterion, if
            given. Example: Original

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "col_co_id": 'ColCoId',
        "payer_id": 'PayerId',
        "payer_number": 'PayerNumber',
        "invoice_id": 'InvoiceId',
        "invoice_number": 'InvoiceNumber',
        "from_date": 'FromDate',
        "to_date": 'ToDate',
        "invoice_date": 'InvoiceDate',
        "summary_document_id": 'SummaryDocumentId',
        "summary_document_number": 'SummaryDocumentNumber',
        "statement_of_account_id": 'StatementOfAccountId',
        "so_a_reference_number": 'SoAReferenceNumber',
        "period": 'Period',
        "invoice_status": 'InvoiceStatus',
        "invoiced_on_behalf_of": 'InvoicedOnBehalfOf',
        "include_e_invoice_details": 'IncludeEInvoiceDetails',
        "col_co_code": 'ColCoCode',
        "accounts": 'Accounts',
        "mtype": 'Type'
    }

    _optionals = [
        'col_co_id',
        'payer_id',
        'payer_number',
        'invoice_id',
        'invoice_number',
        'from_date',
        'to_date',
        'invoice_date',
        'summary_document_id',
        'summary_document_number',
        'statement_of_account_id',
        'so_a_reference_number',
        'period',
        'invoice_status',
        'invoiced_on_behalf_of',
        'include_e_invoice_details',
        'col_co_code',
        'accounts',
        'mtype',
    ]

    _nullables = [
        'col_co_id',
        'payer_id',
        'payer_number',
        'invoice_id',
        'invoice_number',
        'from_date',
        'to_date',
        'invoice_date',
        'summary_document_id',
        'summary_document_number',
        'statement_of_account_id',
        'so_a_reference_number',
        'period',
        'invoice_status',
        'invoiced_on_behalf_of',
        'include_e_invoice_details',
        'col_co_code',
        'mtype',
    ]

    def __init__(self,
                 col_co_id=APIHelper.SKIP,
                 payer_id=APIHelper.SKIP,
                 payer_number=APIHelper.SKIP,
                 invoice_id=APIHelper.SKIP,
                 invoice_number=APIHelper.SKIP,
                 from_date=APIHelper.SKIP,
                 to_date=APIHelper.SKIP,
                 invoice_date=APIHelper.SKIP,
                 summary_document_id=APIHelper.SKIP,
                 summary_document_number=APIHelper.SKIP,
                 statement_of_account_id=APIHelper.SKIP,
                 so_a_reference_number=APIHelper.SKIP,
                 period=APIHelper.SKIP,
                 invoice_status=APIHelper.SKIP,
                 invoiced_on_behalf_of=APIHelper.SKIP,
                 include_e_invoice_details=APIHelper.SKIP,
                 col_co_code=APIHelper.SKIP,
                 accounts=APIHelper.SKIP,
                 mtype=APIHelper.SKIP):
        """Constructor for the InvoiceSummaryRequestFilters class"""

        # Initialize members of the class
        if col_co_id is not APIHelper.SKIP:
            self.col_co_id = col_co_id 
        if payer_id is not APIHelper.SKIP:
            self.payer_id = payer_id 
        if payer_number is not APIHelper.SKIP:
            self.payer_number = payer_number 
        if invoice_id is not APIHelper.SKIP:
            self.invoice_id = invoice_id 
        if invoice_number is not APIHelper.SKIP:
            self.invoice_number = invoice_number 
        if from_date is not APIHelper.SKIP:
            self.from_date = from_date 
        if to_date is not APIHelper.SKIP:
            self.to_date = to_date 
        if invoice_date is not APIHelper.SKIP:
            self.invoice_date = invoice_date 
        if summary_document_id is not APIHelper.SKIP:
            self.summary_document_id = summary_document_id 
        if summary_document_number is not APIHelper.SKIP:
            self.summary_document_number = summary_document_number 
        if statement_of_account_id is not APIHelper.SKIP:
            self.statement_of_account_id = statement_of_account_id 
        if so_a_reference_number is not APIHelper.SKIP:
            self.so_a_reference_number = so_a_reference_number 
        if period is not APIHelper.SKIP:
            self.period = period 
        if invoice_status is not APIHelper.SKIP:
            self.invoice_status = invoice_status 
        if invoiced_on_behalf_of is not APIHelper.SKIP:
            self.invoiced_on_behalf_of = invoiced_on_behalf_of 
        if include_e_invoice_details is not APIHelper.SKIP:
            self.include_e_invoice_details = include_e_invoice_details 
        if col_co_code is not APIHelper.SKIP:
            self.col_co_code = col_co_code 
        if accounts is not APIHelper.SKIP:
            self.accounts = accounts 
        if mtype is not APIHelper.SKIP:
            self.mtype = mtype 

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Creates an instance of this model from a dictionary

        Args:
            dictionary (dictionary): A dictionary representation of the object
            as obtained from the deserialization of the server's response. The
            keys MUST match property names in the API description.

        Returns:
            object: An instance of this structure class.

        """

        if not isinstance(dictionary, dict) or dictionary is None:
            return None

        # Extract variables from the dictionary
        col_co_id = dictionary.get("ColCoId") if "ColCoId" in dictionary.keys() else APIHelper.SKIP
        payer_id = dictionary.get("PayerId") if "PayerId" in dictionary.keys() else APIHelper.SKIP
        payer_number = dictionary.get("PayerNumber") if "PayerNumber" in dictionary.keys() else APIHelper.SKIP
        invoice_id = dictionary.get("InvoiceId") if "InvoiceId" in dictionary.keys() else APIHelper.SKIP
        invoice_number = dictionary.get("InvoiceNumber") if "InvoiceNumber" in dictionary.keys() else APIHelper.SKIP
        from_date = dictionary.get("FromDate") if "FromDate" in dictionary.keys() else APIHelper.SKIP
        to_date = dictionary.get("ToDate") if "ToDate" in dictionary.keys() else APIHelper.SKIP
        invoice_date = dictionary.get("InvoiceDate") if "InvoiceDate" in dictionary.keys() else APIHelper.SKIP
        summary_document_id = dictionary.get("SummaryDocumentId") if "SummaryDocumentId" in dictionary.keys() else APIHelper.SKIP
        summary_document_number = dictionary.get("SummaryDocumentNumber") if "SummaryDocumentNumber" in dictionary.keys() else APIHelper.SKIP
        statement_of_account_id = dictionary.get("StatementOfAccountId") if "StatementOfAccountId" in dictionary.keys() else APIHelper.SKIP
        so_a_reference_number = dictionary.get("SoAReferenceNumber") if "SoAReferenceNumber" in dictionary.keys() else APIHelper.SKIP
        period = dictionary.get("Period") if "Period" in dictionary.keys() else APIHelper.SKIP
        invoice_status = dictionary.get("InvoiceStatus") if "InvoiceStatus" in dictionary.keys() else APIHelper.SKIP
        invoiced_on_behalf_of = dictionary.get("InvoicedOnBehalfOf") if "InvoicedOnBehalfOf" in dictionary.keys() else APIHelper.SKIP
        include_e_invoice_details = dictionary.get("IncludeEInvoiceDetails") if "IncludeEInvoiceDetails" in dictionary.keys() else APIHelper.SKIP
        col_co_code = dictionary.get("ColCoCode") if "ColCoCode" in dictionary.keys() else APIHelper.SKIP
        accounts = None
        if dictionary.get('Accounts') is not None:
            accounts = [Accounts.from_dictionary(x) for x in dictionary.get('Accounts')]
        else:
            accounts = APIHelper.SKIP
        mtype = dictionary.get("Type") if "Type" in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(col_co_id,
                   payer_id,
                   payer_number,
                   invoice_id,
                   invoice_number,
                   from_date,
                   to_date,
                   invoice_date,
                   summary_document_id,
                   summary_document_number,
                   statement_of_account_id,
                   so_a_reference_number,
                   period,
                   invoice_status,
                   invoiced_on_behalf_of,
                   include_e_invoice_details,
                   col_co_code,
                   accounts,
                   mtype)
