# coding: utf-8

"""
    Elastic Email REST API

    This API is based on the REST API architecture, allowing the user to easily manage their data with this resource-based approach.    Every API call is established on which specific request type (GET, POST, PUT, DELETE) will be used.    The API has a limit of 20 concurrent connections and a hard timeout of 600 seconds per request.    To start using this API, you will need your Access Token (available <a target=\"_blank\" href=\"https://app.elasticemail.com/marketing/settings/new/manage-api\">here</a>). Remember to keep it safe. Required access levels are listed in the given request’s description.    Downloadable library clients can be found in our Github repository <a target=\"_blank\" href=\"https://github.com/ElasticEmail?tab=repositories&q=%22rest+api%22+in%3Areadme\">here</a>

    The version of the OpenAPI document: 4.0.0
    Contact: support@elasticemail.com
    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 pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from ElasticEmail.models.certificate_validation_status import CertificateValidationStatus
from ElasticEmail.models.domain_owner import DomainOwner
from ElasticEmail.models.tracking_type import TrackingType
from ElasticEmail.models.tracking_validation_status import TrackingValidationStatus
from typing import Optional, Set
from typing_extensions import Self

class DomainDetail(BaseModel):
    """
    Domain data, with information about domain records.
    """ # noqa: E501
    domain: Optional[StrictStr] = Field(default=None, description="Name of selected domain.", alias="Domain")
    default_domain: Optional[StrictBool] = Field(default=None, description="True, if domain is used as default. Otherwise, false,", alias="DefaultDomain")
    spf: Optional[StrictBool] = Field(default=None, description="True, if SPF record is verified", alias="Spf")
    dkim: Optional[StrictBool] = Field(default=None, description="True, if DKIM record is verified", alias="Dkim")
    mx: Optional[StrictBool] = Field(default=None, description="True, if MX record is verified", alias="MX")
    dmarc: Optional[StrictBool] = Field(default=None, alias="DMARC")
    is_rewrite_domain_valid: Optional[StrictBool] = Field(default=None, description="True, if tracking CNAME record is verified", alias="IsRewriteDomainValid")
    verify: Optional[StrictBool] = Field(default=None, description="True, if DKIM, SPF, or tracking are still to be verified", alias="Verify")
    type: Optional[TrackingType] = Field(default=None, alias="Type")
    tracking_status: Optional[TrackingValidationStatus] = Field(default=None, alias="TrackingStatus")
    certificate_status: Optional[CertificateValidationStatus] = Field(default=None, alias="CertificateStatus")
    certificate_validation_error: Optional[StrictStr] = Field(default=None, alias="CertificateValidationError")
    tracking_type_user_request: Optional[TrackingType] = Field(default=None, alias="TrackingTypeUserRequest")
    verp: Optional[StrictBool] = Field(default=None, alias="VERP")
    custom_bounces_domain: Optional[StrictStr] = Field(default=None, alias="CustomBouncesDomain")
    is_custom_bounces_domain_default: Optional[StrictBool] = Field(default=None, alias="IsCustomBouncesDomainDefault")
    is_marked_for_deletion: Optional[StrictBool] = Field(default=None, alias="IsMarkedForDeletion")
    ownership: Optional[DomainOwner] = Field(default=None, alias="Ownership")
    __properties: ClassVar[List[str]] = ["Domain", "DefaultDomain", "Spf", "Dkim", "MX", "DMARC", "IsRewriteDomainValid", "Verify", "Type", "TrackingStatus", "CertificateStatus", "CertificateValidationError", "TrackingTypeUserRequest", "VERP", "CustomBouncesDomain", "IsCustomBouncesDomainDefault", "IsMarkedForDeletion", "Ownership"]

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


    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.model_dump(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """Create an instance of DomainDetail from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    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,
        )
        return _dict

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

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

        _obj = cls.model_validate({
            "Domain": obj.get("Domain"),
            "DefaultDomain": obj.get("DefaultDomain"),
            "Spf": obj.get("Spf"),
            "Dkim": obj.get("Dkim"),
            "MX": obj.get("MX"),
            "DMARC": obj.get("DMARC"),
            "IsRewriteDomainValid": obj.get("IsRewriteDomainValid"),
            "Verify": obj.get("Verify"),
            "Type": obj.get("Type"),
            "TrackingStatus": obj.get("TrackingStatus"),
            "CertificateStatus": obj.get("CertificateStatus"),
            "CertificateValidationError": obj.get("CertificateValidationError"),
            "TrackingTypeUserRequest": obj.get("TrackingTypeUserRequest"),
            "VERP": obj.get("VERP"),
            "CustomBouncesDomain": obj.get("CustomBouncesDomain"),
            "IsCustomBouncesDomainDefault": obj.get("IsCustomBouncesDomainDefault"),
            "IsMarkedForDeletion": obj.get("IsMarkedForDeletion"),
            "Ownership": obj.get("Ownership")
        })
        return _obj


