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

"""
shelldatareportingapis

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


class InvoiceSearchAdditionalDocument(object):

    """Implementation of the 'InvoiceSearchAdditionalDocument' model.

    Invoice document reference number for the additional invoice files such as
    KSeF file (Poland). This field is optional, and it will be missing if
    additional documents are not applicable. Also, it will not be populated if
    the invoice date is older than 13 months.

    Attributes:
        reference (str): Unique ID for the additional invoice document.
        mtype (str): Type of the additional document. Mandatory Possible
            values: •    KSeF - Applicable for Poland market.
        is_applicable (str): True if a KSeF PDF will be produced for the
            customer.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "reference": 'Reference',
        "mtype": 'Type',
        "is_applicable": 'IsApplicable'
    }

    _optionals = [
        'reference',
        'mtype',
        'is_applicable',
    ]

    _nullables = [
        'reference',
        'mtype',
        'is_applicable',
    ]

    def __init__(self,
                 reference=APIHelper.SKIP,
                 mtype=APIHelper.SKIP,
                 is_applicable=APIHelper.SKIP):
        """Constructor for the InvoiceSearchAdditionalDocument class"""

        # Initialize members of the class
        if reference is not APIHelper.SKIP:
            self.reference = reference 
        if mtype is not APIHelper.SKIP:
            self.mtype = mtype 
        if is_applicable is not APIHelper.SKIP:
            self.is_applicable = is_applicable 

    @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
        reference = dictionary.get("Reference") if "Reference" in dictionary.keys() else APIHelper.SKIP
        mtype = dictionary.get("Type") if "Type" in dictionary.keys() else APIHelper.SKIP
        is_applicable = dictionary.get("IsApplicable") if "IsApplicable" in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(reference,
                   mtype,
                   is_applicable)
