# coding: utf-8

"""
    Managed Ray API

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)  # noqa: E501

    The version of the OpenAPI document: 0.1.0
    Generated by: https://openapi-generator.tech
"""


import pprint
import re  # noqa: F401

import six

from openapi_client.configuration import Configuration


class CreditRecordCommitV2(object):
    """NOTE: This class is auto generated by OpenAPI Generator.
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    """
    Attributes:
      openapi_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.
    """
    openapi_types = {
        'credit_name': 'str',
        'contract_name': 'str',
        'effective_date_start': 'date',
        'effective_date_end': 'date',
        'total_balance_usd': 'float',
        'last_month_usage_usd': 'float',
        'amount_consumed_usd': 'float',
        'total_granted_usd': 'float',
        'ledger': 'list[CommitLedgerRecordV2]',
        'grants': 'list[CreditGrantRecordV2]',
        'credit_type': 'CreditType'
    }

    attribute_map = {
        'credit_name': 'credit_name',
        'contract_name': 'contract_name',
        'effective_date_start': 'effective_date_start',
        'effective_date_end': 'effective_date_end',
        'total_balance_usd': 'total_balance_usd',
        'last_month_usage_usd': 'last_month_usage_usd',
        'amount_consumed_usd': 'amount_consumed_usd',
        'total_granted_usd': 'total_granted_usd',
        'ledger': 'ledger',
        'grants': 'grants',
        'credit_type': 'credit_type'
    }

    def __init__(self, credit_name=None, contract_name=None, effective_date_start=None, effective_date_end=None, total_balance_usd=None, last_month_usage_usd=None, amount_consumed_usd=None, total_granted_usd=None, ledger=None, grants=None, credit_type=None, local_vars_configuration=None):  # noqa: E501
        """CreditRecordCommitV2 - a model defined in OpenAPI"""  # noqa: E501
        if local_vars_configuration is None:
            local_vars_configuration = Configuration()
        self.local_vars_configuration = local_vars_configuration

        self._credit_name = None
        self._contract_name = None
        self._effective_date_start = None
        self._effective_date_end = None
        self._total_balance_usd = None
        self._last_month_usage_usd = None
        self._amount_consumed_usd = None
        self._total_granted_usd = None
        self._ledger = None
        self._grants = None
        self._credit_type = None
        self.discriminator = None

        self.credit_name = credit_name
        self.contract_name = contract_name
        self.effective_date_start = effective_date_start
        self.effective_date_end = effective_date_end
        self.total_balance_usd = total_balance_usd
        self.last_month_usage_usd = last_month_usage_usd
        self.amount_consumed_usd = amount_consumed_usd
        self.total_granted_usd = total_granted_usd
        self.ledger = ledger
        self.grants = grants
        if credit_type is not None:
            self.credit_type = credit_type

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

        Name of the credit.  # noqa: E501

        :return: The credit_name of this CreditRecordCommitV2.  # noqa: E501
        :rtype: str
        """
        return self._credit_name

    @credit_name.setter
    def credit_name(self, credit_name):
        """Sets the credit_name of this CreditRecordCommitV2.

        Name of the credit.  # noqa: E501

        :param credit_name: The credit_name of this CreditRecordCommitV2.  # noqa: E501
        :type: str
        """
        if self.local_vars_configuration.client_side_validation and credit_name is None:  # noqa: E501
            raise ValueError("Invalid value for `credit_name`, must not be `None`")  # noqa: E501

        self._credit_name = credit_name

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

        Name of the contract the credit is attached to.  # noqa: E501

        :return: The contract_name of this CreditRecordCommitV2.  # noqa: E501
        :rtype: str
        """
        return self._contract_name

    @contract_name.setter
    def contract_name(self, contract_name):
        """Sets the contract_name of this CreditRecordCommitV2.

        Name of the contract the credit is attached to.  # noqa: E501

        :param contract_name: The contract_name of this CreditRecordCommitV2.  # noqa: E501
        :type: str
        """
        if self.local_vars_configuration.client_side_validation and contract_name is None:  # noqa: E501
            raise ValueError("Invalid value for `contract_name`, must not be `None`")  # noqa: E501

        self._contract_name = contract_name

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

        UTC date the credit can first be used (inclusive).  # noqa: E501

        :return: The effective_date_start of this CreditRecordCommitV2.  # noqa: E501
        :rtype: date
        """
        return self._effective_date_start

    @effective_date_start.setter
    def effective_date_start(self, effective_date_start):
        """Sets the effective_date_start of this CreditRecordCommitV2.

        UTC date the credit can first be used (inclusive).  # noqa: E501

        :param effective_date_start: The effective_date_start of this CreditRecordCommitV2.  # noqa: E501
        :type: date
        """
        if self.local_vars_configuration.client_side_validation and effective_date_start is None:  # noqa: E501
            raise ValueError("Invalid value for `effective_date_start`, must not be `None`")  # noqa: E501

        self._effective_date_start = effective_date_start

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

        UTC date the credit can last be used (inclusive).  # noqa: E501

        :return: The effective_date_end of this CreditRecordCommitV2.  # noqa: E501
        :rtype: date
        """
        return self._effective_date_end

    @effective_date_end.setter
    def effective_date_end(self, effective_date_end):
        """Sets the effective_date_end of this CreditRecordCommitV2.

        UTC date the credit can last be used (inclusive).  # noqa: E501

        :param effective_date_end: The effective_date_end of this CreditRecordCommitV2.  # noqa: E501
        :type: date
        """
        if self.local_vars_configuration.client_side_validation and effective_date_end is None:  # noqa: E501
            raise ValueError("Invalid value for `effective_date_end`, must not be `None`")  # noqa: E501

        self._effective_date_end = effective_date_end

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

        Total balance of the credit in USD.  # noqa: E501

        :return: The total_balance_usd of this CreditRecordCommitV2.  # noqa: E501
        :rtype: float
        """
        return self._total_balance_usd

    @total_balance_usd.setter
    def total_balance_usd(self, total_balance_usd):
        """Sets the total_balance_usd of this CreditRecordCommitV2.

        Total balance of the credit in USD.  # noqa: E501

        :param total_balance_usd: The total_balance_usd of this CreditRecordCommitV2.  # noqa: E501
        :type: float
        """
        if self.local_vars_configuration.client_side_validation and total_balance_usd is None:  # noqa: E501
            raise ValueError("Invalid value for `total_balance_usd`, must not be `None`")  # noqa: E501

        self._total_balance_usd = total_balance_usd

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

        Amount of USD consumed from the credit in the last month.  # noqa: E501

        :return: The last_month_usage_usd of this CreditRecordCommitV2.  # noqa: E501
        :rtype: float
        """
        return self._last_month_usage_usd

    @last_month_usage_usd.setter
    def last_month_usage_usd(self, last_month_usage_usd):
        """Sets the last_month_usage_usd of this CreditRecordCommitV2.

        Amount of USD consumed from the credit in the last month.  # noqa: E501

        :param last_month_usage_usd: The last_month_usage_usd of this CreditRecordCommitV2.  # noqa: E501
        :type: float
        """
        if self.local_vars_configuration.client_side_validation and last_month_usage_usd is None:  # noqa: E501
            raise ValueError("Invalid value for `last_month_usage_usd`, must not be `None`")  # noqa: E501

        self._last_month_usage_usd = last_month_usage_usd

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

        Amount of USD consumed from the credit.  # noqa: E501

        :return: The amount_consumed_usd of this CreditRecordCommitV2.  # noqa: E501
        :rtype: float
        """
        return self._amount_consumed_usd

    @amount_consumed_usd.setter
    def amount_consumed_usd(self, amount_consumed_usd):
        """Sets the amount_consumed_usd of this CreditRecordCommitV2.

        Amount of USD consumed from the credit.  # noqa: E501

        :param amount_consumed_usd: The amount_consumed_usd of this CreditRecordCommitV2.  # noqa: E501
        :type: float
        """
        if self.local_vars_configuration.client_side_validation and amount_consumed_usd is None:  # noqa: E501
            raise ValueError("Invalid value for `amount_consumed_usd`, must not be `None`")  # noqa: E501

        self._amount_consumed_usd = amount_consumed_usd

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

        Total amount of USD granted to the credit.  # noqa: E501

        :return: The total_granted_usd of this CreditRecordCommitV2.  # noqa: E501
        :rtype: float
        """
        return self._total_granted_usd

    @total_granted_usd.setter
    def total_granted_usd(self, total_granted_usd):
        """Sets the total_granted_usd of this CreditRecordCommitV2.

        Total amount of USD granted to the credit.  # noqa: E501

        :param total_granted_usd: The total_granted_usd of this CreditRecordCommitV2.  # noqa: E501
        :type: float
        """
        if self.local_vars_configuration.client_side_validation and total_granted_usd is None:  # noqa: E501
            raise ValueError("Invalid value for `total_granted_usd`, must not be `None`")  # noqa: E501

        self._total_granted_usd = total_granted_usd

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

        List of ledger records for this credit.  # noqa: E501

        :return: The ledger of this CreditRecordCommitV2.  # noqa: E501
        :rtype: list[CommitLedgerRecordV2]
        """
        return self._ledger

    @ledger.setter
    def ledger(self, ledger):
        """Sets the ledger of this CreditRecordCommitV2.

        List of ledger records for this credit.  # noqa: E501

        :param ledger: The ledger of this CreditRecordCommitV2.  # noqa: E501
        :type: list[CommitLedgerRecordV2]
        """
        if self.local_vars_configuration.client_side_validation and ledger is None:  # noqa: E501
            raise ValueError("Invalid value for `ledger`, must not be `None`")  # noqa: E501

        self._ledger = ledger

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

        List of grant records for this credit.  # noqa: E501

        :return: The grants of this CreditRecordCommitV2.  # noqa: E501
        :rtype: list[CreditGrantRecordV2]
        """
        return self._grants

    @grants.setter
    def grants(self, grants):
        """Sets the grants of this CreditRecordCommitV2.

        List of grant records for this credit.  # noqa: E501

        :param grants: The grants of this CreditRecordCommitV2.  # noqa: E501
        :type: list[CreditGrantRecordV2]
        """
        if self.local_vars_configuration.client_side_validation and grants is None:  # noqa: E501
            raise ValueError("Invalid value for `grants`, must not be `None`")  # noqa: E501

        self._grants = grants

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


        :return: The credit_type of this CreditRecordCommitV2.  # noqa: E501
        :rtype: CreditType
        """
        return self._credit_type

    @credit_type.setter
    def credit_type(self, credit_type):
        """Sets the credit_type of this CreditRecordCommitV2.


        :param credit_type: The credit_type of this CreditRecordCommitV2.  # noqa: E501
        :type: CreditType
        """

        self._credit_type = credit_type

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

        for attr, _ in six.iteritems(self.openapi_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 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, CreditRecordCommitV2):
            return False

        return self.to_dict() == other.to_dict()

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

        return self.to_dict() != other.to_dict()
