# 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 datetime import datetime
from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from ElasticEmail.models.email_validation_result import EmailValidationResult
from ElasticEmail.models.file_upload_result import FileUploadResult
from ElasticEmail.models.verification_status import VerificationStatus
from typing import Optional, Set
from typing_extensions import Self

class VerificationFileResultDetails(BaseModel):
    """
    Detailed verification file result info
    """ # noqa: E501
    verification_result: Optional[List[EmailValidationResult]] = Field(default=None, description="Verification result's details", alias="VerificationResult")
    verification_id: Optional[StrictStr] = Field(default=None, description="Identifier of this verification result", alias="VerificationID")
    filename: Optional[StrictStr] = Field(default=None, description="Origin file name", alias="Filename")
    verification_status: Optional[VerificationStatus] = Field(default=None, alias="VerificationStatus")
    file_upload_result: Optional[FileUploadResult] = Field(default=None, alias="FileUploadResult")
    date_added: Optional[datetime] = Field(default=None, description="Date of creation in YYYY-MM-DDThh:ii:ss format", alias="DateAdded")
    source: Optional[StrictStr] = Field(default=None, description="Origin file extension", alias="Source")
    __properties: ClassVar[List[str]] = ["VerificationResult", "VerificationID", "Filename", "VerificationStatus", "FileUploadResult", "DateAdded", "Source"]

    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 VerificationFileResultDetails 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,
        )
        # override the default output from pydantic by calling `to_dict()` of each item in verification_result (list)
        _items = []
        if self.verification_result:
            for _item in self.verification_result:
                if _item:
                    _items.append(_item.to_dict())
            _dict['VerificationResult'] = _items
        # override the default output from pydantic by calling `to_dict()` of file_upload_result
        if self.file_upload_result:
            _dict['FileUploadResult'] = self.file_upload_result.to_dict()
        return _dict

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

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

        _obj = cls.model_validate({
            "VerificationResult": [EmailValidationResult.from_dict(_item) for _item in obj["VerificationResult"]] if obj.get("VerificationResult") is not None else None,
            "VerificationID": obj.get("VerificationID"),
            "Filename": obj.get("Filename"),
            "VerificationStatus": obj.get("VerificationStatus"),
            "FileUploadResult": FileUploadResult.from_dict(obj["FileUploadResult"]) if obj.get("FileUploadResult") is not None else None,
            "DateAdded": obj.get("DateAdded"),
            "Source": obj.get("Source")
        })
        return _obj


