# coding: utf-8

"""
    Knetik Platform API Documentation latest 

    This is the spec for the Knetik API.  Use this in conjunction with the documentation found at https://knetikcloud.com.

    OpenAPI spec version: latest 
    Contact: support@knetik.com
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from pprint import pformat
from six import iteritems
import re


class CouponItem(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 = {
        'coupon_type_hint': 'str',
        'discount_max': 'float',
        'discount_min_cart_value': 'float',
        'discount_type': 'str',
        'discount_value': 'float',
        'exclusive': 'bool',
        'item_id': 'int',
        'max_quantity': 'int',
        'self_exclusive': 'bool',
        'valid_for_tags': 'list[str]'
    }

    attribute_map = {
        'coupon_type_hint': 'coupon_type_hint',
        'discount_max': 'discount_max',
        'discount_min_cart_value': 'discount_min_cart_value',
        'discount_type': 'discount_type',
        'discount_value': 'discount_value',
        'exclusive': 'exclusive',
        'item_id': 'item_id',
        'max_quantity': 'max_quantity',
        'self_exclusive': 'self_exclusive',
        'valid_for_tags': 'valid_for_tags'
    }

    def __init__(self, coupon_type_hint=None, discount_max=None, discount_min_cart_value=None, discount_type=None, discount_value=None, exclusive=None, item_id=None, max_quantity=None, self_exclusive=None, valid_for_tags=None):
        """
        CouponItem - a model defined in Swagger
        """

        self._coupon_type_hint = None
        self._discount_max = None
        self._discount_min_cart_value = None
        self._discount_type = None
        self._discount_value = None
        self._exclusive = None
        self._item_id = None
        self._max_quantity = None
        self._self_exclusive = None
        self._valid_for_tags = None
        self.discriminator = None

        self.coupon_type_hint = coupon_type_hint
        if discount_max is not None:
          self.discount_max = discount_max
        if discount_min_cart_value is not None:
          self.discount_min_cart_value = discount_min_cart_value
        self.discount_type = discount_type
        self.discount_value = discount_value
        if exclusive is not None:
          self.exclusive = exclusive
        if item_id is not None:
          self.item_id = item_id
        if max_quantity is not None:
          self.max_quantity = max_quantity
        if self_exclusive is not None:
          self.self_exclusive = self_exclusive
        if valid_for_tags is not None:
          self.valid_for_tags = valid_for_tags

    @property
    def coupon_type_hint(self):
        """
        Gets the coupon_type_hint of this CouponItem.
        The type of coupon

        :return: The coupon_type_hint of this CouponItem.
        :rtype: str
        """
        return self._coupon_type_hint

    @coupon_type_hint.setter
    def coupon_type_hint(self, coupon_type_hint):
        """
        Sets the coupon_type_hint of this CouponItem.
        The type of coupon

        :param coupon_type_hint: The coupon_type_hint of this CouponItem.
        :type: str
        """
        if coupon_type_hint is None:
            raise ValueError("Invalid value for `coupon_type_hint`, must not be `None`")
        allowed_values = ["coupon_cart", "coupon_single_item", "coupon_voucher", "coupon_vendor", "coupon_tag"]
        if coupon_type_hint not in allowed_values:
            raise ValueError(
                "Invalid value for `coupon_type_hint` ({0}), must be one of {1}"
                .format(coupon_type_hint, allowed_values)
            )

        self._coupon_type_hint = coupon_type_hint

    @property
    def discount_max(self):
        """
        Gets the discount_max of this CouponItem.
        The amount this coupon is maxed out at.  Applies if coupon_type_hint is coupon_cart

        :return: The discount_max of this CouponItem.
        :rtype: float
        """
        return self._discount_max

    @discount_max.setter
    def discount_max(self, discount_max):
        """
        Sets the discount_max of this CouponItem.
        The amount this coupon is maxed out at.  Applies if coupon_type_hint is coupon_cart

        :param discount_max: The discount_max of this CouponItem.
        :type: float
        """

        self._discount_max = discount_max

    @property
    def discount_min_cart_value(self):
        """
        Gets the discount_min_cart_value of this CouponItem.
        The minimium amount needed in the cart for the coupon to apply.  Applies if coupon_type_hint is coupon_cart

        :return: The discount_min_cart_value of this CouponItem.
        :rtype: float
        """
        return self._discount_min_cart_value

    @discount_min_cart_value.setter
    def discount_min_cart_value(self, discount_min_cart_value):
        """
        Sets the discount_min_cart_value of this CouponItem.
        The minimium amount needed in the cart for the coupon to apply.  Applies if coupon_type_hint is coupon_cart

        :param discount_min_cart_value: The discount_min_cart_value of this CouponItem.
        :type: float
        """

        self._discount_min_cart_value = discount_min_cart_value

    @property
    def discount_type(self):
        """
        Gets the discount_type of this CouponItem.
        The type of discount in terms of how it deducts price. Value based discount not available for coupon_cart type coupons

        :return: The discount_type of this CouponItem.
        :rtype: str
        """
        return self._discount_type

    @discount_type.setter
    def discount_type(self, discount_type):
        """
        Sets the discount_type of this CouponItem.
        The type of discount in terms of how it deducts price. Value based discount not available for coupon_cart type coupons

        :param discount_type: The discount_type of this CouponItem.
        :type: str
        """
        if discount_type is None:
            raise ValueError("Invalid value for `discount_type`, must not be `None`")
        allowed_values = ["value", "percentage"]
        if discount_type not in allowed_values:
            raise ValueError(
                "Invalid value for `discount_type` ({0}), must be one of {1}"
                .format(discount_type, allowed_values)
            )

        self._discount_type = discount_type

    @property
    def discount_value(self):
        """
        Gets the discount_value of this CouponItem.
        The amount the coupon will discount the item. If discount_type is 'value' this will be a flat amount of currency. If discount type is 'percentage' this will be a fraction (0.2 for 20% off) multiplied by the price of the matching item or items.

        :return: The discount_value of this CouponItem.
        :rtype: float
        """
        return self._discount_value

    @discount_value.setter
    def discount_value(self, discount_value):
        """
        Sets the discount_value of this CouponItem.
        The amount the coupon will discount the item. If discount_type is 'value' this will be a flat amount of currency. If discount type is 'percentage' this will be a fraction (0.2 for 20% off) multiplied by the price of the matching item or items.

        :param discount_value: The discount_value of this CouponItem.
        :type: float
        """
        if discount_value is None:
            raise ValueError("Invalid value for `discount_value`, must not be `None`")

        self._discount_value = discount_value

    @property
    def exclusive(self):
        """
        Gets the exclusive of this CouponItem.
        Whether this coupon is exclusive or not (true means cannot be in same cart as another).  Default = false

        :return: The exclusive of this CouponItem.
        :rtype: bool
        """
        return self._exclusive

    @exclusive.setter
    def exclusive(self, exclusive):
        """
        Sets the exclusive of this CouponItem.
        Whether this coupon is exclusive or not (true means cannot be in same cart as another).  Default = false

        :param exclusive: The exclusive of this CouponItem.
        :type: bool
        """

        self._exclusive = exclusive

    @property
    def item_id(self):
        """
        Gets the item_id of this CouponItem.
        The id of the item the coupon is applied to.  Applies if coupon_type_hint is coupon_single_item or coupon_voucher

        :return: The item_id of this CouponItem.
        :rtype: int
        """
        return self._item_id

    @item_id.setter
    def item_id(self, item_id):
        """
        Sets the item_id of this CouponItem.
        The id of the item the coupon is applied to.  Applies if coupon_type_hint is coupon_single_item or coupon_voucher

        :param item_id: The item_id of this CouponItem.
        :type: int
        """

        self._item_id = item_id

    @property
    def max_quantity(self):
        """
        Gets the max_quantity of this CouponItem.
        The maximum quantity of items the coupon can apply to, null if no limit and minimum 1 otherwise.  Applies if coupon_type_hint is coupon_single_item or coupon_voucher

        :return: The max_quantity of this CouponItem.
        :rtype: int
        """
        return self._max_quantity

    @max_quantity.setter
    def max_quantity(self, max_quantity):
        """
        Sets the max_quantity of this CouponItem.
        The maximum quantity of items the coupon can apply to, null if no limit and minimum 1 otherwise.  Applies if coupon_type_hint is coupon_single_item or coupon_voucher

        :param max_quantity: The max_quantity of this CouponItem.
        :type: int
        """

        self._max_quantity = max_quantity

    @property
    def self_exclusive(self):
        """
        Gets the self_exclusive of this CouponItem.
        Whether this coupon is exclusive to itself or not (true means cannot add two of this same coupon to the same cart).  Default = false

        :return: The self_exclusive of this CouponItem.
        :rtype: bool
        """
        return self._self_exclusive

    @self_exclusive.setter
    def self_exclusive(self, self_exclusive):
        """
        Sets the self_exclusive of this CouponItem.
        Whether this coupon is exclusive to itself or not (true means cannot add two of this same coupon to the same cart).  Default = false

        :param self_exclusive: The self_exclusive of this CouponItem.
        :type: bool
        """

        self._self_exclusive = self_exclusive

    @property
    def valid_for_tags(self):
        """
        Gets the valid_for_tags of this CouponItem.
        A list of tags for a coupon.  The coupon can only apply to an item that has at least one of these tags.  Applies if coupon_type_hint is coupon_tag

        :return: The valid_for_tags of this CouponItem.
        :rtype: list[str]
        """
        return self._valid_for_tags

    @valid_for_tags.setter
    def valid_for_tags(self, valid_for_tags):
        """
        Sets the valid_for_tags of this CouponItem.
        A list of tags for a coupon.  The coupon can only apply to an item that has at least one of these tags.  Applies if coupon_type_hint is coupon_tag

        :param valid_for_tags: The valid_for_tags of this CouponItem.
        :type: list[str]
        """

        self._valid_for_tags = valid_for_tags

    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
        """
        if not isinstance(other, CouponItem):
            return False

        return self.__dict__ == other.__dict__

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