# coding: utf-8

"""
    Selling Partner API for Retail Procurement Payments

    The Selling Partner API for Retail Procurement Payments provides programmatic access to vendors payments data.

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

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


import pprint
import re  # noqa: F401

import six

from spapi.configuration import Configuration


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

    Do not edit the class manually.
    """

    """
    Attributes:
      swagger_types (dict): The key is attribute name
                            and the value is attribute type.
      attribute_map (dict): The key is attribute name
                            and the value is json key in definition.
    """
    swagger_types = {
        'invoice_type': 'str',
        'id': 'str',
        'reference_number': 'str',
        'var_date': 'datetime',
        'remit_to_party': 'PartyIdentification',
        'ship_to_party': 'PartyIdentification',
        'ship_from_party': 'PartyIdentification',
        'bill_to_party': 'PartyIdentification',
        'payment_terms': 'PaymentTerms',
        'invoice_total': 'Money',
        'tax_details': 'List[TaxDetails]',
        'additional_details': 'List[AdditionalDetails]',
        'charge_details': 'List[ChargeDetails]',
        'allowance_details': 'List[AllowanceDetails]',
        'items': 'List[InvoiceItem]',
    }

    attribute_map = {
        'invoice_type': 'invoiceType',
        'id': 'id',
        'reference_number': 'referenceNumber',
        'var_date': 'date',
        'remit_to_party': 'remitToParty',
        'ship_to_party': 'shipToParty',
        'ship_from_party': 'shipFromParty',
        'bill_to_party': 'billToParty',
        'payment_terms': 'paymentTerms',
        'invoice_total': 'invoiceTotal',
        'tax_details': 'taxDetails',
        'additional_details': 'additionalDetails',
        'charge_details': 'chargeDetails',
        'allowance_details': 'allowanceDetails',
        'items': 'items',
    }

    def __init__(self, invoice_type=None, id=None, reference_number=None, var_date=None, remit_to_party=None, ship_to_party=None, ship_from_party=None, bill_to_party=None, payment_terms=None, invoice_total=None, tax_details=None, additional_details=None, charge_details=None, allowance_details=None, items=None, _configuration=None):  # noqa: E501
        """Invoice - a model defined in Swagger"""  # noqa: E501
        if _configuration is None:
            _configuration = Configuration()
        self._configuration = _configuration

        self._invoice_type = None
        self._id = None
        self._reference_number = None
        self._var_date = None
        self._remit_to_party = None
        self._ship_to_party = None
        self._ship_from_party = None
        self._bill_to_party = None
        self._payment_terms = None
        self._invoice_total = None
        self._tax_details = None
        self._additional_details = None
        self._charge_details = None
        self._allowance_details = None
        self._items = None
        self.discriminator = None

        self.invoice_type = invoice_type
        self.id = id
        if reference_number is not None:
            self.reference_number = reference_number
        self.var_date = var_date
        self.remit_to_party = remit_to_party
        if ship_to_party is not None:
            self.ship_to_party = ship_to_party
        if ship_from_party is not None:
            self.ship_from_party = ship_from_party
        if bill_to_party is not None:
            self.bill_to_party = bill_to_party
        if payment_terms is not None:
            self.payment_terms = payment_terms
        self.invoice_total = invoice_total
        if tax_details is not None:
            self.tax_details = tax_details
        if additional_details is not None:
            self.additional_details = additional_details
        if charge_details is not None:
            self.charge_details = charge_details
        if allowance_details is not None:
            self.allowance_details = allowance_details
        if items is not None:
            self.items = items

    @property
    def invoice_type(self):
        """Gets the invoice_type of this Invoice.  # noqa: E501

        Identifies the type of invoice.  # noqa: E501

        :return: The invoice_type of this Invoice.  # noqa: E501
        :rtype: str
        """
        return self._invoice_type

    @invoice_type.setter
    def invoice_type(self, invoice_type):
        """Sets the invoice_type of this Invoice.

        Identifies the type of invoice.  # noqa: E501

        :param invoice_type: The invoice_type of this Invoice.  # noqa: E501
        :type: str
        """
        if self._configuration.client_side_validation and invoice_type is None:
            raise ValueError("Invalid value for `invoice_type`, must not be `None`")  # noqa: E501
        allowed_values = ["Invoice", "CreditNote"]  # noqa: E501
        if (self._configuration.client_side_validation and
                invoice_type not in allowed_values):
            raise ValueError(
                "Invalid value for `invoice_type` ({0}), must be one of {1}"  # noqa: E501
                .format(invoice_type, allowed_values)
            )

        self._invoice_type = invoice_type

    @property
    def id(self):
        """Gets the id of this Invoice.  # noqa: E501

        Unique number relating to the charges defined in this document. This will be invoice number if the document type is Invoice or CreditNote number if the document type is Credit Note. Failure to provide this reference will result in a rejection.  # noqa: E501

        :return: The id of this Invoice.  # noqa: E501
        :rtype: str
        """
        return self._id

    @id.setter
    def id(self, id):
        """Sets the id of this Invoice.

        Unique number relating to the charges defined in this document. This will be invoice number if the document type is Invoice or CreditNote number if the document type is Credit Note. Failure to provide this reference will result in a rejection.  # noqa: E501

        :param id: The id of this Invoice.  # noqa: E501
        :type: str
        """
        if self._configuration.client_side_validation and id is None:
            raise ValueError("Invalid value for `id`, must not be `None`")  # noqa: E501

        self._id = id

    @property
    def reference_number(self):
        """Gets the reference_number of this Invoice.  # noqa: E501

        An additional unique reference number used for regulatory or other purposes.  # noqa: E501

        :return: The reference_number of this Invoice.  # noqa: E501
        :rtype: str
        """
        return self._reference_number

    @reference_number.setter
    def reference_number(self, reference_number):
        """Sets the reference_number of this Invoice.

        An additional unique reference number used for regulatory or other purposes.  # noqa: E501

        :param reference_number: The reference_number of this Invoice.  # noqa: E501
        :type: str
        """

        self._reference_number = reference_number

    @property
    def var_date(self):
        """Gets the var_date of this Invoice.  # noqa: E501

        Defines a date and time according to ISO8601.  # noqa: E501

        :return: The var_date of this Invoice.  # noqa: E501
        :rtype: datetime
        """
        return self._var_date

    @var_date.setter
    def var_date(self, var_date):
        """Sets the var_date of this Invoice.

        Defines a date and time according to ISO8601.  # noqa: E501

        :param var_date: The var_date of this Invoice.  # noqa: E501
        :type: datetime
        """
        if self._configuration.client_side_validation and var_date is None:
            raise ValueError("Invalid value for `var_date`, must not be `None`")  # noqa: E501

        self._var_date = var_date

    @property
    def remit_to_party(self):
        """Gets the remit_to_party of this Invoice.  # noqa: E501


        :return: The remit_to_party of this Invoice.  # noqa: E501
        :rtype: PartyIdentification
        """
        return self._remit_to_party

    @remit_to_party.setter
    def remit_to_party(self, remit_to_party):
        """Sets the remit_to_party of this Invoice.


        :param remit_to_party: The remit_to_party of this Invoice.  # noqa: E501
        :type: PartyIdentification
        """
        if self._configuration.client_side_validation and remit_to_party is None:
            raise ValueError("Invalid value for `remit_to_party`, must not be `None`")  # noqa: E501

        self._remit_to_party = remit_to_party

    @property
    def ship_to_party(self):
        """Gets the ship_to_party of this Invoice.  # noqa: E501


        :return: The ship_to_party of this Invoice.  # noqa: E501
        :rtype: PartyIdentification
        """
        return self._ship_to_party

    @ship_to_party.setter
    def ship_to_party(self, ship_to_party):
        """Sets the ship_to_party of this Invoice.


        :param ship_to_party: The ship_to_party of this Invoice.  # noqa: E501
        :type: PartyIdentification
        """

        self._ship_to_party = ship_to_party

    @property
    def ship_from_party(self):
        """Gets the ship_from_party of this Invoice.  # noqa: E501


        :return: The ship_from_party of this Invoice.  # noqa: E501
        :rtype: PartyIdentification
        """
        return self._ship_from_party

    @ship_from_party.setter
    def ship_from_party(self, ship_from_party):
        """Sets the ship_from_party of this Invoice.


        :param ship_from_party: The ship_from_party of this Invoice.  # noqa: E501
        :type: PartyIdentification
        """

        self._ship_from_party = ship_from_party

    @property
    def bill_to_party(self):
        """Gets the bill_to_party of this Invoice.  # noqa: E501


        :return: The bill_to_party of this Invoice.  # noqa: E501
        :rtype: PartyIdentification
        """
        return self._bill_to_party

    @bill_to_party.setter
    def bill_to_party(self, bill_to_party):
        """Sets the bill_to_party of this Invoice.


        :param bill_to_party: The bill_to_party of this Invoice.  # noqa: E501
        :type: PartyIdentification
        """

        self._bill_to_party = bill_to_party

    @property
    def payment_terms(self):
        """Gets the payment_terms of this Invoice.  # noqa: E501


        :return: The payment_terms of this Invoice.  # noqa: E501
        :rtype: PaymentTerms
        """
        return self._payment_terms

    @payment_terms.setter
    def payment_terms(self, payment_terms):
        """Sets the payment_terms of this Invoice.


        :param payment_terms: The payment_terms of this Invoice.  # noqa: E501
        :type: PaymentTerms
        """

        self._payment_terms = payment_terms

    @property
    def invoice_total(self):
        """Gets the invoice_total of this Invoice.  # noqa: E501


        :return: The invoice_total of this Invoice.  # noqa: E501
        :rtype: Money
        """
        return self._invoice_total

    @invoice_total.setter
    def invoice_total(self, invoice_total):
        """Sets the invoice_total of this Invoice.


        :param invoice_total: The invoice_total of this Invoice.  # noqa: E501
        :type: Money
        """
        if self._configuration.client_side_validation and invoice_total is None:
            raise ValueError("Invalid value for `invoice_total`, must not be `None`")  # noqa: E501

        self._invoice_total = invoice_total

    @property
    def tax_details(self):
        """Gets the tax_details of this Invoice.  # noqa: E501

        Total tax amount details for all line items.  # noqa: E501

        :return: The tax_details of this Invoice.  # noqa: E501
        :rtype: List[TaxDetails]
        """
        return self._tax_details

    @tax_details.setter
    def tax_details(self, tax_details):
        """Sets the tax_details of this Invoice.

        Total tax amount details for all line items.  # noqa: E501

        :param tax_details: The tax_details of this Invoice.  # noqa: E501
        :type: List[TaxDetails]
        """

        self._tax_details = tax_details

    @property
    def additional_details(self):
        """Gets the additional_details of this Invoice.  # noqa: E501

        Additional details provided by the selling party, for tax related or other purposes.  # noqa: E501

        :return: The additional_details of this Invoice.  # noqa: E501
        :rtype: List[AdditionalDetails]
        """
        return self._additional_details

    @additional_details.setter
    def additional_details(self, additional_details):
        """Sets the additional_details of this Invoice.

        Additional details provided by the selling party, for tax related or other purposes.  # noqa: E501

        :param additional_details: The additional_details of this Invoice.  # noqa: E501
        :type: List[AdditionalDetails]
        """

        self._additional_details = additional_details

    @property
    def charge_details(self):
        """Gets the charge_details of this Invoice.  # noqa: E501

        Total charge amount details for all line items.  # noqa: E501

        :return: The charge_details of this Invoice.  # noqa: E501
        :rtype: List[ChargeDetails]
        """
        return self._charge_details

    @charge_details.setter
    def charge_details(self, charge_details):
        """Sets the charge_details of this Invoice.

        Total charge amount details for all line items.  # noqa: E501

        :param charge_details: The charge_details of this Invoice.  # noqa: E501
        :type: List[ChargeDetails]
        """

        self._charge_details = charge_details

    @property
    def allowance_details(self):
        """Gets the allowance_details of this Invoice.  # noqa: E501

        Total allowance amount details for all line items.  # noqa: E501

        :return: The allowance_details of this Invoice.  # noqa: E501
        :rtype: List[AllowanceDetails]
        """
        return self._allowance_details

    @allowance_details.setter
    def allowance_details(self, allowance_details):
        """Sets the allowance_details of this Invoice.

        Total allowance amount details for all line items.  # noqa: E501

        :param allowance_details: The allowance_details of this Invoice.  # noqa: E501
        :type: List[AllowanceDetails]
        """

        self._allowance_details = allowance_details

    @property
    def items(self):
        """Gets the items of this Invoice.  # noqa: E501

        The list of invoice items.  # noqa: E501

        :return: The items of this Invoice.  # noqa: E501
        :rtype: List[InvoiceItem]
        """
        return self._items

    @items.setter
    def items(self, items):
        """Sets the items of this Invoice.

        The list of invoice items.  # noqa: E501

        :param items: The items of this Invoice.  # noqa: E501
        :type: List[InvoiceItem]
        """

        self._items = items

    def to_dict(self):
        """Returns the model properties as a dict"""
        result = {}

        for attr, _ in six.iteritems(self.swagger_types):
            value = getattr(self, attr)
            if isinstance(value, list):
                result[attr] = list(map(
                    lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
                    value
                ))
            elif hasattr(value, "to_dict"):
                result[attr] = value.to_dict()
            elif isinstance(value, dict):
                result[attr] = dict(map(
                    lambda item: (item[0], item[1].to_dict())
                    if hasattr(item[1], "to_dict") else item,
                    value.items()
                ))
            else:
                result[attr] = value
        if issubclass(Invoice, dict):
            for key, value in self.items():
                result[key] = value

        return result

    def to_str(self):
        """Returns the string representation of the model"""
        return pprint.pformat(self.to_dict())

    def __repr__(self):
        """For `print` and `pprint`"""
        return self.to_str()

    def __eq__(self, other):
        """Returns true if both objects are equal"""
        if not isinstance(other, Invoice):
            return False

        return self.to_dict() == other.to_dict()

    def __ne__(self, other):
        """Returns true if both objects are not equal"""
        if not isinstance(other, Invoice):
            return True

        return self.to_dict() != other.to_dict()
