# coding: utf-8

"""
Copyright 2017 Square, Inc.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
"""


from pprint import pformat
from six import iteritems
import re


class CatalogPricingRule(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    """
    def __init__(self, name=None, time_period_ids=None, total_price_money=None, item_price_money=None, discount_id=None, match_products_id=None, apply_products_id=None, stackable=None, exclude_products_id=None, valid_from_date=None, valid_from_local_time=None, valid_until_date=None, valid_until_local_time=None):
        """
        CatalogPricingRule - a model defined in Swagger

        :param dict swaggerTypes: The key is attribute name
                                  and the value is attribute type.
        :param dict attributeMap: The key is attribute name
                                  and the value is json key in definition.
        """
        self.swagger_types = {
            'name': 'str',
            'time_period_ids': 'list[str]',
            'total_price_money': 'Money',
            'item_price_money': 'Money',
            'discount_id': 'str',
            'match_products_id': 'str',
            'apply_products_id': 'str',
            'stackable': 'str',
            'exclude_products_id': 'str',
            'valid_from_date': 'str',
            'valid_from_local_time': 'str',
            'valid_until_date': 'str',
            'valid_until_local_time': 'str'
        }

        self.attribute_map = {
            'name': 'name',
            'time_period_ids': 'time_period_ids',
            'total_price_money': 'total_price_money',
            'item_price_money': 'item_price_money',
            'discount_id': 'discount_id',
            'match_products_id': 'match_products_id',
            'apply_products_id': 'apply_products_id',
            'stackable': 'stackable',
            'exclude_products_id': 'exclude_products_id',
            'valid_from_date': 'valid_from_date',
            'valid_from_local_time': 'valid_from_local_time',
            'valid_until_date': 'valid_until_date',
            'valid_until_local_time': 'valid_until_local_time'
        }

        self._name = name
        self._time_period_ids = time_period_ids
        self._total_price_money = total_price_money
        self._item_price_money = item_price_money
        self._discount_id = discount_id
        self._match_products_id = match_products_id
        self._apply_products_id = apply_products_id
        self._stackable = stackable
        self._exclude_products_id = exclude_products_id
        self._valid_from_date = valid_from_date
        self._valid_from_local_time = valid_from_local_time
        self._valid_until_date = valid_until_date
        self._valid_until_local_time = valid_until_local_time

    @property
    def name(self):
        """
        Gets the name of this CatalogPricingRule.
        User-defined name for the pricing rule. For example, \"Buy one get one free\" or \"10% off\".

        :return: The name of this CatalogPricingRule.
        :rtype: str
        """
        return self._name

    @name.setter
    def name(self, name):
        """
        Sets the name of this CatalogPricingRule.
        User-defined name for the pricing rule. For example, \"Buy one get one free\" or \"10% off\".

        :param name: The name of this CatalogPricingRule.
        :type: str
        """

        self._name = name

    @property
    def time_period_ids(self):
        """
        Gets the time_period_ids of this CatalogPricingRule.
        Unique ID for the [CatalogTimePeriod](#type-catalogtimeperiod)s when this pricing rule is in effect. If left unset, the pricing rule is always in effect.

        :return: The time_period_ids of this CatalogPricingRule.
        :rtype: list[str]
        """
        return self._time_period_ids

    @time_period_ids.setter
    def time_period_ids(self, time_period_ids):
        """
        Sets the time_period_ids of this CatalogPricingRule.
        Unique ID for the [CatalogTimePeriod](#type-catalogtimeperiod)s when this pricing rule is in effect. If left unset, the pricing rule is always in effect.

        :param time_period_ids: The time_period_ids of this CatalogPricingRule.
        :type: list[str]
        """

        self._time_period_ids = time_period_ids

    @property
    def total_price_money(self):
        """
        Gets the total_price_money of this CatalogPricingRule.
        The total amount of money to charge for all matched items.  Only one of `total_price_money`, `item_price`, or `discount` can be supplied.

        :return: The total_price_money of this CatalogPricingRule.
        :rtype: Money
        """
        return self._total_price_money

    @total_price_money.setter
    def total_price_money(self, total_price_money):
        """
        Sets the total_price_money of this CatalogPricingRule.
        The total amount of money to charge for all matched items.  Only one of `total_price_money`, `item_price`, or `discount` can be supplied.

        :param total_price_money: The total_price_money of this CatalogPricingRule.
        :type: Money
        """

        self._total_price_money = total_price_money

    @property
    def item_price_money(self):
        """
        Gets the item_price_money of this CatalogPricingRule.
        The amount of money to charge for each matched item.  Only one of `total_price_money`, `item_price`, or `discount` can be supplied.

        :return: The item_price_money of this CatalogPricingRule.
        :rtype: Money
        """
        return self._item_price_money

    @item_price_money.setter
    def item_price_money(self, item_price_money):
        """
        Sets the item_price_money of this CatalogPricingRule.
        The amount of money to charge for each matched item.  Only one of `total_price_money`, `item_price`, or `discount` can be supplied.

        :param item_price_money: The item_price_money of this CatalogPricingRule.
        :type: Money
        """

        self._item_price_money = item_price_money

    @property
    def discount_id(self):
        """
        Gets the discount_id of this CatalogPricingRule.
        Unique ID for the [CatalogDiscount](#type-catalogdiscount) to take off the price of all matched items.  Only one of `total_price_money`, `item_price`, or `discount` can be supplied.

        :return: The discount_id of this CatalogPricingRule.
        :rtype: str
        """
        return self._discount_id

    @discount_id.setter
    def discount_id(self, discount_id):
        """
        Sets the discount_id of this CatalogPricingRule.
        Unique ID for the [CatalogDiscount](#type-catalogdiscount) to take off the price of all matched items.  Only one of `total_price_money`, `item_price`, or `discount` can be supplied.

        :param discount_id: The discount_id of this CatalogPricingRule.
        :type: str
        """

        self._discount_id = discount_id

    @property
    def match_products_id(self):
        """
        Gets the match_products_id of this CatalogPricingRule.
        Unique ID for the [CatalogProductSet](#type-catalogproductset) that will be matched by this rule. A match rule matches within the entire cart.

        :return: The match_products_id of this CatalogPricingRule.
        :rtype: str
        """
        return self._match_products_id

    @match_products_id.setter
    def match_products_id(self, match_products_id):
        """
        Sets the match_products_id of this CatalogPricingRule.
        Unique ID for the [CatalogProductSet](#type-catalogproductset) that will be matched by this rule. A match rule matches within the entire cart.

        :param match_products_id: The match_products_id of this CatalogPricingRule.
        :type: str
        """

        self._match_products_id = match_products_id

    @property
    def apply_products_id(self):
        """
        Gets the apply_products_id of this CatalogPricingRule.
        The [CatalogProductSet](#type-catalogproductset) to apply the pricing rule to within the set of matched products specified by `match_products_id`. An apply rule can only match once within the set of matched products. If left unset, the pricing rule will be applied to all products within the set of matched products.

        :return: The apply_products_id of this CatalogPricingRule.
        :rtype: str
        """
        return self._apply_products_id

    @apply_products_id.setter
    def apply_products_id(self, apply_products_id):
        """
        Sets the apply_products_id of this CatalogPricingRule.
        The [CatalogProductSet](#type-catalogproductset) to apply the pricing rule to within the set of matched products specified by `match_products_id`. An apply rule can only match once within the set of matched products. If left unset, the pricing rule will be applied to all products within the set of matched products.

        :param apply_products_id: The apply_products_id of this CatalogPricingRule.
        :type: str
        """

        self._apply_products_id = apply_products_id

    @property
    def stackable(self):
        """
        Gets the stackable of this CatalogPricingRule.
        Describes how the pricing rule can be combined with other pricing rules. See [Stackable](#type-stackable) for all possible values. See [AggregationStrategy](#type-aggregationstrategy) for possible values

        :return: The stackable of this CatalogPricingRule.
        :rtype: str
        """
        return self._stackable

    @stackable.setter
    def stackable(self, stackable):
        """
        Sets the stackable of this CatalogPricingRule.
        Describes how the pricing rule can be combined with other pricing rules. See [Stackable](#type-stackable) for all possible values. See [AggregationStrategy](#type-aggregationstrategy) for possible values

        :param stackable: The stackable of this CatalogPricingRule.
        :type: str
        """

        self._stackable = stackable

    @property
    def exclude_products_id(self):
        """
        Gets the exclude_products_id of this CatalogPricingRule.
        Identifies the [CatalogProductSet](#type-catalogproductset) to exclude from this pricing rule. An exclude rule matches within the subset of the cart that fits the match rules (the match set). An exclude rule can only match once in the match set. If not supplied, the pricing will be applied to all products in the match set. Other products retain their base price, or a price generated by other rules.

        :return: The exclude_products_id of this CatalogPricingRule.
        :rtype: str
        """
        return self._exclude_products_id

    @exclude_products_id.setter
    def exclude_products_id(self, exclude_products_id):
        """
        Sets the exclude_products_id of this CatalogPricingRule.
        Identifies the [CatalogProductSet](#type-catalogproductset) to exclude from this pricing rule. An exclude rule matches within the subset of the cart that fits the match rules (the match set). An exclude rule can only match once in the match set. If not supplied, the pricing will be applied to all products in the match set. Other products retain their base price, or a price generated by other rules.

        :param exclude_products_id: The exclude_products_id of this CatalogPricingRule.
        :type: str
        """

        self._exclude_products_id = exclude_products_id

    @property
    def valid_from_date(self):
        """
        Gets the valid_from_date of this CatalogPricingRule.
        Represents the date the Pricing Rule is valid from. Represented in RFC3339 full-date format (YYYY-MM-DD).

        :return: The valid_from_date of this CatalogPricingRule.
        :rtype: str
        """
        return self._valid_from_date

    @valid_from_date.setter
    def valid_from_date(self, valid_from_date):
        """
        Sets the valid_from_date of this CatalogPricingRule.
        Represents the date the Pricing Rule is valid from. Represented in RFC3339 full-date format (YYYY-MM-DD).

        :param valid_from_date: The valid_from_date of this CatalogPricingRule.
        :type: str
        """

        self._valid_from_date = valid_from_date

    @property
    def valid_from_local_time(self):
        """
        Gets the valid_from_local_time of this CatalogPricingRule.
        Represents the local time the pricing rule should be valid from. Time zone is determined by the device running the Point of Sale app.  Represented in RFC3339 partial-time format (HH:MM:SS). Partial seconds will be truncated.

        :return: The valid_from_local_time of this CatalogPricingRule.
        :rtype: str
        """
        return self._valid_from_local_time

    @valid_from_local_time.setter
    def valid_from_local_time(self, valid_from_local_time):
        """
        Sets the valid_from_local_time of this CatalogPricingRule.
        Represents the local time the pricing rule should be valid from. Time zone is determined by the device running the Point of Sale app.  Represented in RFC3339 partial-time format (HH:MM:SS). Partial seconds will be truncated.

        :param valid_from_local_time: The valid_from_local_time of this CatalogPricingRule.
        :type: str
        """

        self._valid_from_local_time = valid_from_local_time

    @property
    def valid_until_date(self):
        """
        Gets the valid_until_date of this CatalogPricingRule.
        Represents the date the pricing rule will become inactive.  Represented in RFC3339 full-date format (YYYY-MM-DD).

        :return: The valid_until_date of this CatalogPricingRule.
        :rtype: str
        """
        return self._valid_until_date

    @valid_until_date.setter
    def valid_until_date(self, valid_until_date):
        """
        Sets the valid_until_date of this CatalogPricingRule.
        Represents the date the pricing rule will become inactive.  Represented in RFC3339 full-date format (YYYY-MM-DD).

        :param valid_until_date: The valid_until_date of this CatalogPricingRule.
        :type: str
        """

        self._valid_until_date = valid_until_date

    @property
    def valid_until_local_time(self):
        """
        Gets the valid_until_local_time of this CatalogPricingRule.
        Represents the local time at which the pricing rule will become inactive. Time zone is determined by the device running the Point of Sale app.  Represented in RFC3339 partial-time format (HH:MM:SS). Partial seconds will be truncated.

        :return: The valid_until_local_time of this CatalogPricingRule.
        :rtype: str
        """
        return self._valid_until_local_time

    @valid_until_local_time.setter
    def valid_until_local_time(self, valid_until_local_time):
        """
        Sets the valid_until_local_time of this CatalogPricingRule.
        Represents the local time at which the pricing rule will become inactive. Time zone is determined by the device running the Point of Sale app.  Represented in RFC3339 partial-time format (HH:MM:SS). Partial seconds will be truncated.

        :param valid_until_local_time: The valid_until_local_time of this CatalogPricingRule.
        :type: str
        """

        self._valid_until_local_time = valid_until_local_time

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

        for attr, _ in 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

        return result

    def to_str(self):
        """
        Returns the string representation of the model
        """
        return 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
        """
        return self.__dict__ == other.__dict__

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