# coding: utf-8

"""
    CustomerManagementService

    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 openapi_client.models.customer.key_value_pair_ofstring_and_byte_array import KeyValuePairOfstringAndByteArray
from openapi_client.models.customer.tax_certificate_status import TaxCertificateStatus
from typing_extensions import Self

class AccountTaxCertificate(BaseModel):
    """
    AccountTaxCertificate
    """ # noqa: E501
    tax_certificate_blob_container_name: Optional[StrictStr] = Field(default=None, alias="TaxCertificateBlobContainerName")
    tax_certificates: Optional[List[Optional[KeyValuePairOfstringAndByteArray]]] = Field(default=None, alias="TaxCertificates")
    status: Optional[TaxCertificateStatus] = Field(default=None, alias="Status")
    __properties: ClassVar[List[str]] = ["TaxCertificateBlobContainerName", "TaxCertificates", "Status"]

    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,
        )
        # override the default output from pydantic by calling `to_dict()` of each item in tax_certificates (list)
        _items = []
        if self.tax_certificates:
            for _item_tax_certificates in self.tax_certificates:
                if _item_tax_certificates:
                    _items.append(_item_tax_certificates.to_dict())
            _dict['TaxCertificates'] = _items
        # set to None if tax_certificate_blob_container_name (nullable) is None
        # and model_fields_set contains the field
        if self.tax_certificate_blob_container_name is None and "tax_certificate_blob_container_name" in self.model_fields_set:
            _dict['TaxCertificateBlobContainerName'] = None

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "TaxCertificateBlobContainerName": obj.get("TaxCertificateBlobContainerName") if obj.get("TaxCertificateBlobContainerName") is not None else None,
                        "TaxCertificates": [KeyValuePairOfstringAndByteArray.from_dict(_item) for _item in obj["TaxCertificates"]] if obj.get("TaxCertificates") is not None else None,
                        "Status": obj.get("Status") if obj.get("Status") is not None else None
        })
        return _obj
