# coding: utf-8

"""
    Lotus API

    Lotus is an open-core pricing and billing engine. We enable API companies to automate and optimize their custom usage-based pricing for any metric.  # noqa: E501

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

import pprint
import re  # noqa: F401

import six

class InvoiceLineItem(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 = {
        'name': 'str',
        'start_date': 'datetime',
        'end_date': 'datetime',
        'quantity': 'float',
        'billing_type': 'str',
        'metadata': 'dict(str, object)',
        'plan': 'AllOfInvoiceLineItemPlan',
        'subscription_filters': 'list[SubscriptionFilter]',
        'base': 'float',
        'adjustments': 'list[InvoiceLineItemAdjustment]',
        'amount': 'float',
        'subtotal': 'float'
    }

    attribute_map = {
        'name': 'name',
        'start_date': 'start_date',
        'end_date': 'end_date',
        'quantity': 'quantity',
        'billing_type': 'billing_type',
        'metadata': 'metadata',
        'plan': 'plan',
        'subscription_filters': 'subscription_filters',
        'base': 'base',
        'adjustments': 'adjustments',
        'amount': 'amount',
        'subtotal': 'subtotal'
    }

    def __init__(self, name=None, start_date=None, end_date=None, quantity=None, billing_type=None, metadata=None, plan=None, subscription_filters=None, base=None, adjustments=None, amount=None, subtotal=None):  # noqa: E501
        """InvoiceLineItem - a model defined in Swagger"""  # noqa: E501
        self._name = None
        self._start_date = None
        self._end_date = None
        self._quantity = None
        self._billing_type = None
        self._metadata = None
        self._plan = None
        self._subscription_filters = None
        self._base = None
        self._adjustments = None
        self._amount = None
        self._subtotal = None
        self.discriminator = None
        self.name = name
        self.start_date = start_date
        self.end_date = end_date
        self.quantity = quantity
        self.billing_type = billing_type
        self.metadata = metadata
        self.plan = plan
        self.subscription_filters = subscription_filters
        self.base = base
        self.adjustments = adjustments
        self.amount = amount
        self.subtotal = subtotal

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


        :return: The name of this InvoiceLineItem.  # noqa: E501
        :rtype: str
        """
        return self._name

    @name.setter
    def name(self, name):
        """Sets the name of this InvoiceLineItem.


        :param name: The name of this InvoiceLineItem.  # noqa: E501
        :type: str
        """
        if name is None:
            raise ValueError("Invalid value for `name`, must not be `None`")  # noqa: E501

        self._name = name

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


        :return: The start_date of this InvoiceLineItem.  # noqa: E501
        :rtype: datetime
        """
        return self._start_date

    @start_date.setter
    def start_date(self, start_date):
        """Sets the start_date of this InvoiceLineItem.


        :param start_date: The start_date of this InvoiceLineItem.  # noqa: E501
        :type: datetime
        """
        if start_date is None:
            raise ValueError("Invalid value for `start_date`, must not be `None`")  # noqa: E501

        self._start_date = start_date

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


        :return: The end_date of this InvoiceLineItem.  # noqa: E501
        :rtype: datetime
        """
        return self._end_date

    @end_date.setter
    def end_date(self, end_date):
        """Sets the end_date of this InvoiceLineItem.


        :param end_date: The end_date of this InvoiceLineItem.  # noqa: E501
        :type: datetime
        """
        if end_date is None:
            raise ValueError("Invalid value for `end_date`, must not be `None`")  # noqa: E501

        self._end_date = end_date

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


        :return: The quantity of this InvoiceLineItem.  # noqa: E501
        :rtype: float
        """
        return self._quantity

    @quantity.setter
    def quantity(self, quantity):
        """Sets the quantity of this InvoiceLineItem.


        :param quantity: The quantity of this InvoiceLineItem.  # noqa: E501
        :type: float
        """
        if quantity is None:
            raise ValueError("Invalid value for `quantity`, must not be `None`")  # noqa: E501

        self._quantity = quantity

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

        * `in_arrears` - In Arrears * `intermediate` - Intermediate * `in_advance` - In Advance * `one_time` - One Time  # noqa: E501

        :return: The billing_type of this InvoiceLineItem.  # noqa: E501
        :rtype: str
        """
        return self._billing_type

    @billing_type.setter
    def billing_type(self, billing_type):
        """Sets the billing_type of this InvoiceLineItem.

        * `in_arrears` - In Arrears * `intermediate` - Intermediate * `in_advance` - In Advance * `one_time` - One Time  # noqa: E501

        :param billing_type: The billing_type of this InvoiceLineItem.  # noqa: E501
        :type: str
        """
        if billing_type is None:
            raise ValueError("Invalid value for `billing_type`, must not be `None`")  # noqa: E501
        allowed_values = ["in_arrears", "intermediate", "in_advance", "one_time", ""]  # noqa: E501
        if billing_type not in allowed_values:
            raise ValueError(
                "Invalid value for `billing_type` ({0}), must be one of {1}"  # noqa: E501
                .format(billing_type, allowed_values)
            )

        self._billing_type = billing_type

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


        :return: The metadata of this InvoiceLineItem.  # noqa: E501
        :rtype: dict(str, object)
        """
        return self._metadata

    @metadata.setter
    def metadata(self, metadata):
        """Sets the metadata of this InvoiceLineItem.


        :param metadata: The metadata of this InvoiceLineItem.  # noqa: E501
        :type: dict(str, object)
        """
        if metadata is None:
            raise ValueError("Invalid value for `metadata`, must not be `None`")  # noqa: E501

        self._metadata = metadata

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


        :return: The plan of this InvoiceLineItem.  # noqa: E501
        :rtype: AllOfInvoiceLineItemPlan
        """
        return self._plan

    @plan.setter
    def plan(self, plan):
        """Sets the plan of this InvoiceLineItem.


        :param plan: The plan of this InvoiceLineItem.  # noqa: E501
        :type: AllOfInvoiceLineItemPlan
        """
        if plan is None:
            raise ValueError("Invalid value for `plan`, must not be `None`")  # noqa: E501

        self._plan = plan

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


        :return: The subscription_filters of this InvoiceLineItem.  # noqa: E501
        :rtype: list[SubscriptionFilter]
        """
        return self._subscription_filters

    @subscription_filters.setter
    def subscription_filters(self, subscription_filters):
        """Sets the subscription_filters of this InvoiceLineItem.


        :param subscription_filters: The subscription_filters of this InvoiceLineItem.  # noqa: E501
        :type: list[SubscriptionFilter]
        """
        if subscription_filters is None:
            raise ValueError("Invalid value for `subscription_filters`, must not be `None`")  # noqa: E501

        self._subscription_filters = subscription_filters

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

        Base price of the line item. This is the price before any adjustments are applied.  # noqa: E501

        :return: The base of this InvoiceLineItem.  # noqa: E501
        :rtype: float
        """
        return self._base

    @base.setter
    def base(self, base):
        """Sets the base of this InvoiceLineItem.

        Base price of the line item. This is the price before any adjustments are applied.  # noqa: E501

        :param base: The base of this InvoiceLineItem.  # noqa: E501
        :type: float
        """
        if base is None:
            raise ValueError("Invalid value for `base`, must not be `None`")  # noqa: E501

        self._base = base

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


        :return: The adjustments of this InvoiceLineItem.  # noqa: E501
        :rtype: list[InvoiceLineItemAdjustment]
        """
        return self._adjustments

    @adjustments.setter
    def adjustments(self, adjustments):
        """Sets the adjustments of this InvoiceLineItem.


        :param adjustments: The adjustments of this InvoiceLineItem.  # noqa: E501
        :type: list[InvoiceLineItemAdjustment]
        """
        if adjustments is None:
            raise ValueError("Invalid value for `adjustments`, must not be `None`")  # noqa: E501

        self._adjustments = adjustments

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

        Amount of the line item. This is the price after any adjustments are applied.  # noqa: E501

        :return: The amount of this InvoiceLineItem.  # noqa: E501
        :rtype: float
        """
        return self._amount

    @amount.setter
    def amount(self, amount):
        """Sets the amount of this InvoiceLineItem.

        Amount of the line item. This is the price after any adjustments are applied.  # noqa: E501

        :param amount: The amount of this InvoiceLineItem.  # noqa: E501
        :type: float
        """
        if amount is None:
            raise ValueError("Invalid value for `amount`, must not be `None`")  # noqa: E501

        self._amount = amount

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


        :return: The subtotal of this InvoiceLineItem.  # noqa: E501
        :rtype: float
        """
        return self._subtotal

    @subtotal.setter
    def subtotal(self, subtotal):
        """Sets the subtotal of this InvoiceLineItem.


        :param subtotal: The subtotal of this InvoiceLineItem.  # noqa: E501
        :type: float
        """
        if subtotal is None:
            raise ValueError("Invalid value for `subtotal`, must not be `None`")  # noqa: E501

        self._subtotal = subtotal

    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(InvoiceLineItem, 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, InvoiceLineItem):
            return False

        return self.__dict__ == other.__dict__

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