# coding: utf-8

"""
    CardPay REST API

    Welcome to the CardPay REST API. The CardPay API uses HTTP verbs and a [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) resources endpoint structure (see more info about REST). Request and response payloads are formatted as JSON. Merchant uses API to create payments, refunds, payouts or recurrings, check or update transaction status and get information about created transactions. In API authentication process based on [OAuth 2.0](https://oauth.net/2/) standard. For recent changes see changelog section.  # noqa: E501

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


import pprint
import re  # noqa: F401

import six

from cardpay.model.plan import Plan  # noqa: F401,E501


class SubscriptionUpdateRequestSubscriptionData(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 = {
        "amount": "float",
        "next_payment_date": "datetime",
        "plan": "Plan",
        "status_to": "str",
        "units": "int",
    }

    attribute_map = {
        "amount": "amount",
        "next_payment_date": "next_payment_date",
        "plan": "plan",
        "status_to": "status_to",
        "units": "units",
    }

    def __init__(
        self, amount=None, next_payment_date=None, plan=None, status_to=None, units=None
    ):  # noqa: E501
        """SubscriptionUpdateRequestSubscriptionData - a model defined in Swagger"""  # noqa: E501

        self._amount = None
        self._next_payment_date = None
        self._plan = None
        self._status_to = None
        self._units = None
        self.discriminator = None

        if amount is not None:
            self.amount = amount
        if next_payment_date is not None:
            self.next_payment_date = next_payment_date
        if plan is not None:
            self.plan = plan
        if status_to is not None:
            self.status_to = status_to
        if units is not None:
            self.units = units

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

        Set amount of repayment with dot as a decimal separator. Skip this attribute from request to repay the rest of subscription's amount and complete it. Mandatory for `REPAYMENT` operation only with exact payment amount.  # noqa: E501

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

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

        Set amount of repayment with dot as a decimal separator. Skip this attribute from request to repay the rest of subscription's amount and complete it. Mandatory for `REPAYMENT` operation only with exact payment amount.  # noqa: E501

        :param amount: The amount of this SubscriptionUpdateRequestSubscriptionData.  # noqa: E501
        :type: float
        """

        self._amount = amount

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


        :return: The next_payment_date of this SubscriptionUpdateRequestSubscriptionData.  # noqa: E501
        :rtype: datetime
        """
        return self._next_payment_date

    @next_payment_date.setter
    def next_payment_date(self, next_payment_date):
        """Sets the next_payment_date of this SubscriptionUpdateRequestSubscriptionData.


        :param next_payment_date: The next_payment_date of this SubscriptionUpdateRequestSubscriptionData.  # noqa: E501
        :type: datetime
        """

        self._next_payment_date = next_payment_date

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

        Plan data to which the subscription will be changed  # noqa: E501

        :return: The plan of this SubscriptionUpdateRequestSubscriptionData.  # noqa: E501
        :rtype: Plan
        """
        return self._plan

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

        Plan data to which the subscription will be changed  # noqa: E501

        :param plan: The plan of this SubscriptionUpdateRequestSubscriptionData.  # noqa: E501
        :type: Plan
        """

        self._plan = plan

    class StatusTo(object):
        ACTIVE = "ACTIVE"
        INACTIVE = "INACTIVE"
        CANCELLED = "CANCELLED"
        PAST_DUE = "PAST_DUE"
        PENDING = "PENDING"
        COMPLETED = "COMPLETED"
        CARD_EXPIRED = "CARD_EXPIRED"
        ACTIVATION_FAILED = "ACTIVATION_FAILED"

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

        Set status and action on subscription. Mandatory for `CHANGE_STATUS` operation only: `CANCELLED` - cancels and ends `INACTIVE` - **for scheduled only**; suspends `ACTIVE` - **for scheduled only**; resumes after suspend  # noqa: E501

        :return: The status_to of this SubscriptionUpdateRequestSubscriptionData.  # noqa: E501
        :rtype: str
        """
        return self._status_to

    @status_to.setter
    def status_to(self, status_to):
        """Sets the status_to of this SubscriptionUpdateRequestSubscriptionData.

        Set status and action on subscription. Mandatory for `CHANGE_STATUS` operation only: `CANCELLED` - cancels and ends `INACTIVE` - **for scheduled only**; suspends `ACTIVE` - **for scheduled only**; resumes after suspend  # noqa: E501

        :param status_to: The status_to of this SubscriptionUpdateRequestSubscriptionData.  # noqa: E501
        :type: str
        """
        allowed_values = [
            "ACTIVE",
            "INACTIVE",
            "CANCELLED",
            "PAST_DUE",
            "PENDING",
            "COMPLETED",
            "CARD_EXPIRED",
            "ACTIVATION_FAILED",
        ]  # noqa: E501
        if status_to not in allowed_values:
            raise ValueError(
                "Invalid value for `status_to` ({0}), must be one of {1}".format(  # noqa: E501
                    status_to, allowed_values
                )
            )

        self._status_to = status_to

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

        New quantity of subscription units  # noqa: E501

        :return: The units of this SubscriptionUpdateRequestSubscriptionData.  # noqa: E501
        :rtype: int
        """
        return self._units

    @units.setter
    def units(self, units):
        """Sets the units of this SubscriptionUpdateRequestSubscriptionData.

        New quantity of subscription units  # noqa: E501

        :param units: The units of this SubscriptionUpdateRequestSubscriptionData.  # noqa: E501
        :type: int
        """

        self._units = units

    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:
                if value is not None:
                    result[attr] = value
        if issubclass(SubscriptionUpdateRequestSubscriptionData, 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, SubscriptionUpdateRequestSubscriptionData):
            return False

        return self.__dict__ == other.__dict__

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