# 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.next_subscription_payment import (
    NextSubscriptionPayment,
)  # noqa: F401,E501
from cardpay.model.payout_response_customer import (
    PayoutResponseCustomer,
)  # noqa: F401,E501
from cardpay.model.plan import Plan  # noqa: F401,E501


class SubscriptionGetResponse(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_due": "float",
        "amount_total": "float",
        "created": "datetime",
        "currency": "str",
        "customer": "PayoutResponseCustomer",
        "description": "str",
        "id": "str",
        "interval": "int",
        "next_payment": "NextSubscriptionPayment",
        "payments_due": "int",
        "period": "str",
        "plan": "Plan",
        "retries": "int",
        "status": "str",
        "status_reason": "str",
        "subscription_start": "datetime",
        "type": "str",
    }

    attribute_map = {
        "amount_due": "amount_due",
        "amount_total": "amount_total",
        "created": "created",
        "currency": "currency",
        "customer": "customer",
        "description": "description",
        "id": "id",
        "interval": "interval",
        "next_payment": "next_payment",
        "payments_due": "payments_due",
        "period": "period",
        "plan": "plan",
        "retries": "retries",
        "status": "status",
        "status_reason": "status_reason",
        "subscription_start": "subscription_start",
        "type": "type",
    }

    def __init__(
        self,
        amount_due=None,
        amount_total=None,
        created=None,
        currency=None,
        customer=None,
        description=None,
        id=None,
        interval=None,
        next_payment=None,
        payments_due=None,
        period=None,
        plan=None,
        retries=None,
        status=None,
        status_reason=None,
        subscription_start=None,
        type=None,
    ):  # noqa: E501
        """SubscriptionGetResponse - a model defined in Swagger"""  # noqa: E501

        self._amount_due = None
        self._amount_total = None
        self._created = None
        self._currency = None
        self._customer = None
        self._description = None
        self._id = None
        self._interval = None
        self._next_payment = None
        self._payments_due = None
        self._period = None
        self._plan = None
        self._retries = None
        self._status = None
        self._status_reason = None
        self._subscription_start = None
        self._type = None
        self.discriminator = None

        if amount_due is not None:
            self.amount_due = amount_due
        if amount_total is not None:
            self.amount_total = amount_total
        if created is not None:
            self.created = created
        if currency is not None:
            self.currency = currency
        if customer is not None:
            self.customer = customer
        if description is not None:
            self.description = description
        if id is not None:
            self.id = id
        if interval is not None:
            self.interval = interval
        if next_payment is not None:
            self.next_payment = next_payment
        if payments_due is not None:
            self.payments_due = payments_due
        if period is not None:
            self.period = period
        if plan is not None:
            self.plan = plan
        if retries is not None:
            self.retries = retries
        if status is not None:
            self.status = status
        if status_reason is not None:
            self.status_reason = status_reason
        if subscription_start is not None:
            self.subscription_start = subscription_start
        if type is not None:
            self.type = type

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

        Amount of payments left to be captured  # noqa: E501

        :return: The amount_due of this SubscriptionGetResponse.  # noqa: E501
        :rtype: float
        """
        return self._amount_due

    @amount_due.setter
    def amount_due(self, amount_due):
        """Sets the amount_due of this SubscriptionGetResponse.

        Amount of payments left to be captured  # noqa: E501

        :param amount_due: The amount_due of this SubscriptionGetResponse.  # noqa: E501
        :type: float
        """

        self._amount_due = amount_due

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

        Total amount of subscription to be paid before completion  # noqa: E501

        :return: The amount_total of this SubscriptionGetResponse.  # noqa: E501
        :rtype: float
        """
        return self._amount_total

    @amount_total.setter
    def amount_total(self, amount_total):
        """Sets the amount_total of this SubscriptionGetResponse.

        Total amount of subscription to be paid before completion  # noqa: E501

        :param amount_total: The amount_total of this SubscriptionGetResponse.  # noqa: E501
        :type: float
        """

        self._amount_total = amount_total

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

        Creation time [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format  # noqa: E501

        :return: The created of this SubscriptionGetResponse.  # noqa: E501
        :rtype: datetime
        """
        return self._created

    @created.setter
    def created(self, created):
        """Sets the created of this SubscriptionGetResponse.

        Creation time [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format  # noqa: E501

        :param created: The created of this SubscriptionGetResponse.  # noqa: E501
        :type: datetime
        """

        self._created = created

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

        [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code  # noqa: E501

        :return: The currency of this SubscriptionGetResponse.  # noqa: E501
        :rtype: str
        """
        return self._currency

    @currency.setter
    def currency(self, currency):
        """Sets the currency of this SubscriptionGetResponse.

        [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code  # noqa: E501

        :param currency: The currency of this SubscriptionGetResponse.  # noqa: E501
        :type: str
        """

        self._currency = currency

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

        Customer data  # noqa: E501

        :return: The customer of this SubscriptionGetResponse.  # noqa: E501
        :rtype: PayoutResponseCustomer
        """
        return self._customer

    @customer.setter
    def customer(self, customer):
        """Sets the customer of this SubscriptionGetResponse.

        Customer data  # noqa: E501

        :param customer: The customer of this SubscriptionGetResponse.  # noqa: E501
        :type: PayoutResponseCustomer
        """

        self._customer = customer

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

        Description of subscription  # noqa: E501

        :return: The description of this SubscriptionGetResponse.  # noqa: E501
        :rtype: str
        """
        return self._description

    @description.setter
    def description(self, description):
        """Sets the description of this SubscriptionGetResponse.

        Description of subscription  # noqa: E501

        :param description: The description of this SubscriptionGetResponse.  # noqa: E501
        :type: str
        """

        self._description = description

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

        ID of subscription  # noqa: E501

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

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

        ID of subscription  # noqa: E501

        :param id: The id of this SubscriptionGetResponse.  # noqa: E501
        :type: str
        """

        self._id = id

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

        Interval of subscription  # noqa: E501

        :return: The interval of this SubscriptionGetResponse.  # noqa: E501
        :rtype: int
        """
        return self._interval

    @interval.setter
    def interval(self, interval):
        """Sets the interval of this SubscriptionGetResponse.

        Interval of subscription  # noqa: E501

        :param interval: The interval of this SubscriptionGetResponse.  # noqa: E501
        :type: int
        """

        self._interval = interval

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

        Next payment data  # noqa: E501

        :return: The next_payment of this SubscriptionGetResponse.  # noqa: E501
        :rtype: NextSubscriptionPayment
        """
        return self._next_payment

    @next_payment.setter
    def next_payment(self, next_payment):
        """Sets the next_payment of this SubscriptionGetResponse.

        Next payment data  # noqa: E501

        :param next_payment: The next_payment of this SubscriptionGetResponse.  # noqa: E501
        :type: NextSubscriptionPayment
        """

        self._next_payment = next_payment

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

        Number of payments left to be captured  # noqa: E501

        :return: The payments_due of this SubscriptionGetResponse.  # noqa: E501
        :rtype: int
        """
        return self._payments_due

    @payments_due.setter
    def payments_due(self, payments_due):
        """Sets the payments_due of this SubscriptionGetResponse.

        Number of payments left to be captured  # noqa: E501

        :param payments_due: The payments_due of this SubscriptionGetResponse.  # noqa: E501
        :type: int
        """

        self._payments_due = payments_due

    class Period(object):
        MINUTE = "minute"
        DAY = "day"
        WEEK = "week"
        MONTH = "month"
        YEAR = "year"

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

        Period of subscription  # noqa: E501

        :return: The period of this SubscriptionGetResponse.  # noqa: E501
        :rtype: str
        """
        return self._period

    @period.setter
    def period(self, period):
        """Sets the period of this SubscriptionGetResponse.

        Period of subscription  # noqa: E501

        :param period: The period of this SubscriptionGetResponse.  # noqa: E501
        :type: str
        """
        allowed_values = ["minute", "day", "week", "month", "year"]  # noqa: E501
        if period not in allowed_values:
            raise ValueError(
                "Invalid value for `period` ({0}), must be one of {1}".format(  # noqa: E501
                    period, allowed_values
                )
            )

        self._period = period

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

        Plan data  # noqa: E501

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

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

        Plan data  # noqa: E501

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

        self._plan = plan

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

        Number of daily basis retry attempts in case of payment has not been captured successfully.  # noqa: E501

        :return: The retries of this SubscriptionGetResponse.  # noqa: E501
        :rtype: int
        """
        return self._retries

    @retries.setter
    def retries(self, retries):
        """Sets the retries of this SubscriptionGetResponse.

        Number of daily basis retry attempts in case of payment has not been captured successfully.  # noqa: E501

        :param retries: The retries of this SubscriptionGetResponse.  # noqa: E501
        :type: int
        """

        self._retries = retries

    class Status(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(self):
        """Gets the status of this SubscriptionGetResponse.  # noqa: E501

        Status of subscription  # noqa: E501

        :return: The status of this SubscriptionGetResponse.  # noqa: E501
        :rtype: str
        """
        return self._status

    @status.setter
    def status(self, status):
        """Sets the status of this SubscriptionGetResponse.

        Status of subscription  # noqa: E501

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

        self._status = status

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

        Reason of subscription cancellation that was made by CardPay  # noqa: E501

        :return: The status_reason of this SubscriptionGetResponse.  # noqa: E501
        :rtype: str
        """
        return self._status_reason

    @status_reason.setter
    def status_reason(self, status_reason):
        """Sets the status_reason of this SubscriptionGetResponse.

        Reason of subscription cancellation that was made by CardPay  # noqa: E501

        :param status_reason: The status_reason of this SubscriptionGetResponse.  # noqa: E501
        :type: str
        """

        self._status_reason = status_reason

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

        The time in 'yyyy-MM-dd' format when subscription actually becomes activated (grace period)  # noqa: E501

        :return: The subscription_start of this SubscriptionGetResponse.  # noqa: E501
        :rtype: datetime
        """
        return self._subscription_start

    @subscription_start.setter
    def subscription_start(self, subscription_start):
        """Sets the subscription_start of this SubscriptionGetResponse.

        The time in 'yyyy-MM-dd' format when subscription actually becomes activated (grace period)  # noqa: E501

        :param subscription_start: The subscription_start of this SubscriptionGetResponse.  # noqa: E501
        :type: datetime
        """

        self._subscription_start = subscription_start

    class Type(object):
        ONECLICK = "ONECLICK"
        SCHEDULED = "SCHEDULED"
        INSTALLMENT = "INSTALLMENT"

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

        Recurring payment type name; can be ONECLICK, SCHEDULED, INSTALLMENT  # noqa: E501

        :return: The type of this SubscriptionGetResponse.  # noqa: E501
        :rtype: str
        """
        return self._type

    @type.setter
    def type(self, type):
        """Sets the type of this SubscriptionGetResponse.

        Recurring payment type name; can be ONECLICK, SCHEDULED, INSTALLMENT  # noqa: E501

        :param type: The type of this SubscriptionGetResponse.  # noqa: E501
        :type: str
        """
        allowed_values = ["ONECLICK", "SCHEDULED", "INSTALLMENT"]  # noqa: E501
        if type not in allowed_values:
            raise ValueError(
                "Invalid value for `type` ({0}), must be one of {1}".format(  # noqa: E501
                    type, allowed_values
                )
            )

        self._type = type

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

        return self.__dict__ == other.__dict__

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