# coding: utf-8

"""
    CustomerBillingService

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

    The version of the OpenAPI document: 1.0.0
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import pprint
import re  # noqa: F401
import json

from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union, Set
from typing_extensions import Self

class CouponRedemption(BaseModel):
    """
    CouponRedemption
    """ # noqa: E501
    account_id: Optional[StrictStr] = Field(default=None, alias="AccountId")
    account_number: Optional[StrictStr] = Field(default=None, alias="AccountNumber")
    spend_to_threshold: Optional[StrictFloat] = Field(default=None, alias="SpendToThreshold")
    balance: Optional[StrictFloat] = Field(default=None, alias="Balance")
    currency_code: Optional[StrictStr] = Field(default=None, alias="CurrencyCode")
    redemption_date: Optional[datetime] = Field(default=None, alias="RedemptionDate")
    expiration_date: Optional[datetime] = Field(default=None, alias="ExpirationDate")
    activation_date: Optional[datetime] = Field(default=None, alias="ActivationDate")
    __properties: ClassVar[List[str]] = ["AccountId", "AccountNumber", "SpendToThreshold", "Balance", "CurrencyCode", "RedemptionDate", "ExpirationDate", "ActivationDate"]

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )
	

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        # set to None if account_id (nullable) is None
        # and model_fields_set contains the field
        if self.account_id is None and "account_id" in self.model_fields_set:
            _dict['AccountId'] = None

        # set to None if account_number (nullable) is None
        # and model_fields_set contains the field
        if self.account_number is None and "account_number" in self.model_fields_set:
            _dict['AccountNumber'] = None

        # set to None if spend_to_threshold (nullable) is None
        # and model_fields_set contains the field
        if self.spend_to_threshold is None and "spend_to_threshold" in self.model_fields_set:
            _dict['SpendToThreshold'] = None

        # set to None if balance (nullable) is None
        # and model_fields_set contains the field
        if self.balance is None and "balance" in self.model_fields_set:
            _dict['Balance'] = None

        # set to None if currency_code (nullable) is None
        # and model_fields_set contains the field
        if self.currency_code is None and "currency_code" in self.model_fields_set:
            _dict['CurrencyCode'] = None

        # set to None if redemption_date (nullable) is None
        # and model_fields_set contains the field
        if self.redemption_date is None and "redemption_date" in self.model_fields_set:
            _dict['RedemptionDate'] = None

        # set to None if expiration_date (nullable) is None
        # and model_fields_set contains the field
        if self.expiration_date is None and "expiration_date" in self.model_fields_set:
            _dict['ExpirationDate'] = None

        # set to None if activation_date (nullable) is None
        # and model_fields_set contains the field
        if self.activation_date is None and "activation_date" in self.model_fields_set:
            _dict['ActivationDate'] = None

        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of CouponRedemption from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        _obj = cls.model_validate({
            "AccountId": obj.get("AccountId") if obj.get("AccountId") is not None else None,
                        "AccountNumber": obj.get("AccountNumber") if obj.get("AccountNumber") is not None else None,
                        "SpendToThreshold": obj.get("SpendToThreshold") if obj.get("SpendToThreshold") is not None else None,
                        "Balance": obj.get("Balance") if obj.get("Balance") is not None else None,
                        "CurrencyCode": obj.get("CurrencyCode") if obj.get("CurrencyCode") is not None else None,
                        "RedemptionDate": obj.get("RedemptionDate") if obj.get("RedemptionDate") is not None else None,
                        "ExpirationDate": obj.get("ExpirationDate") if obj.get("ExpirationDate") is not None else None,
                        "ActivationDate": obj.get("ActivationDate") if obj.get("ActivationDate") is not None else None
        })
        return _obj
