# coding: utf-8

"""
    Jellyfin API

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

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

class RemoteSubtitleInfo(BaseModel):
    """
    RemoteSubtitleInfo
    """ # noqa: E501
    three_letter_iso_language_name: Optional[StrictStr] = Field(default=None, alias="ThreeLetterISOLanguageName")
    id: Optional[StrictStr] = Field(default=None, alias="Id")
    provider_name: Optional[StrictStr] = Field(default=None, alias="ProviderName")
    name: Optional[StrictStr] = Field(default=None, alias="Name")
    format: Optional[StrictStr] = Field(default=None, alias="Format")
    author: Optional[StrictStr] = Field(default=None, alias="Author")
    comment: Optional[StrictStr] = Field(default=None, alias="Comment")
    date_created: Optional[datetime] = Field(default=None, alias="DateCreated")
    community_rating: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="CommunityRating")
    frame_rate: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="FrameRate")
    download_count: Optional[StrictInt] = Field(default=None, alias="DownloadCount")
    is_hash_match: Optional[StrictBool] = Field(default=None, alias="IsHashMatch")
    ai_translated: Optional[StrictBool] = Field(default=None, alias="AiTranslated")
    machine_translated: Optional[StrictBool] = Field(default=None, alias="MachineTranslated")
    forced: Optional[StrictBool] = Field(default=None, alias="Forced")
    hearing_impaired: Optional[StrictBool] = Field(default=None, alias="HearingImpaired")
    __properties: ClassVar[List[str]] = ["ThreeLetterISOLanguageName", "Id", "ProviderName", "Name", "Format", "Author", "Comment", "DateCreated", "CommunityRating", "FrameRate", "DownloadCount", "IsHashMatch", "AiTranslated", "MachineTranslated", "Forced", "HearingImpaired"]

    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 RemoteSubtitleInfo 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 three_letter_iso_language_name (nullable) is None
        # and model_fields_set contains the field
        if self.three_letter_iso_language_name is None and "three_letter_iso_language_name" in self.model_fields_set:
            _dict['ThreeLetterISOLanguageName'] = None

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "ThreeLetterISOLanguageName": obj.get("ThreeLetterISOLanguageName"),
            "Id": obj.get("Id"),
            "ProviderName": obj.get("ProviderName"),
            "Name": obj.get("Name"),
            "Format": obj.get("Format"),
            "Author": obj.get("Author"),
            "Comment": obj.get("Comment"),
            "DateCreated": obj.get("DateCreated"),
            "CommunityRating": obj.get("CommunityRating"),
            "FrameRate": obj.get("FrameRate"),
            "DownloadCount": obj.get("DownloadCount"),
            "IsHashMatch": obj.get("IsHashMatch"),
            "AiTranslated": obj.get("AiTranslated"),
            "MachineTranslated": obj.get("MachineTranslated"),
            "Forced": obj.get("Forced"),
            "HearingImpaired": obj.get("HearingImpaired")
        })
        return _obj


