# coding: utf-8

"""
    Onboarding Buddy API

    This document details all the available operations in the Onboarding Buddy API specification

    The version of the OpenAPI document: v1
    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 typing import Optional, Set
from typing_extensions import Self

class EmailAddressResultM(BaseModel):
    """
    EmailAddressResultM
    """ # noqa: E501
    email_address: Optional[StrictStr] = Field(default=None, alias="emailAddress")
    email_status: Optional[StrictStr] = Field(default=None, alias="emailStatus")
    free_email: Optional[StrictBool] = Field(default=None, alias="freeEmail")
    did_you_mean: Optional[StrictStr] = Field(default=None, alias="didYouMean")
    domain: Optional[StrictStr] = None
    mx_found: Optional[StrictBool] = Field(default=None, alias="mxFound")
    mx_record: Optional[StrictStr] = Field(default=None, alias="mxRecord")
    is_disposable_domain: Optional[StrictBool] = Field(default=None, alias="isDisposableDomain")
    check_status: Optional[StrictStr] = Field(default=None, alias="checkStatus")
    __properties: ClassVar[List[str]] = ["emailAddress", "emailStatus", "freeEmail", "didYouMean", "domain", "mxFound", "mxRecord", "isDisposableDomain", "checkStatus"]

    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 EmailAddressResultM 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,
        )
        # set to None if email_address (nullable) is None
        # and model_fields_set contains the field
        if self.email_address is None and "email_address" in self.model_fields_set:
            _dict['emailAddress'] = None

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "emailAddress": obj.get("emailAddress"),
            "emailStatus": obj.get("emailStatus"),
            "freeEmail": obj.get("freeEmail"),
            "didYouMean": obj.get("didYouMean"),
            "domain": obj.get("domain"),
            "mxFound": obj.get("mxFound"),
            "mxRecord": obj.get("mxRecord"),
            "isDisposableDomain": obj.get("isDisposableDomain"),
            "checkStatus": obj.get("checkStatus")
        })
        return _obj


