# 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 pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class TunerHostInfo(BaseModel):
    """
    TunerHostInfo
    """ # noqa: E501
    id: Optional[StrictStr] = Field(default=None, alias="Id")
    url: Optional[StrictStr] = Field(default=None, alias="Url")
    type: Optional[StrictStr] = Field(default=None, alias="Type")
    device_id: Optional[StrictStr] = Field(default=None, alias="DeviceId")
    friendly_name: Optional[StrictStr] = Field(default=None, alias="FriendlyName")
    import_favorites_only: Optional[StrictBool] = Field(default=None, alias="ImportFavoritesOnly")
    allow_hw_transcoding: Optional[StrictBool] = Field(default=None, alias="AllowHWTranscoding")
    allow_fmp4_transcoding_container: Optional[StrictBool] = Field(default=None, alias="AllowFmp4TranscodingContainer")
    allow_stream_sharing: Optional[StrictBool] = Field(default=None, alias="AllowStreamSharing")
    fallback_max_streaming_bitrate: Optional[StrictInt] = Field(default=None, alias="FallbackMaxStreamingBitrate")
    enable_stream_looping: Optional[StrictBool] = Field(default=None, alias="EnableStreamLooping")
    source: Optional[StrictStr] = Field(default=None, alias="Source")
    tuner_count: Optional[StrictInt] = Field(default=None, alias="TunerCount")
    user_agent: Optional[StrictStr] = Field(default=None, alias="UserAgent")
    ignore_dts: Optional[StrictBool] = Field(default=None, alias="IgnoreDts")
    read_at_native_framerate: Optional[StrictBool] = Field(default=None, alias="ReadAtNativeFramerate")
    __properties: ClassVar[List[str]] = ["Id", "Url", "Type", "DeviceId", "FriendlyName", "ImportFavoritesOnly", "AllowHWTranscoding", "AllowFmp4TranscodingContainer", "AllowStreamSharing", "FallbackMaxStreamingBitrate", "EnableStreamLooping", "Source", "TunerCount", "UserAgent", "IgnoreDts", "ReadAtNativeFramerate"]

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "Id": obj.get("Id"),
            "Url": obj.get("Url"),
            "Type": obj.get("Type"),
            "DeviceId": obj.get("DeviceId"),
            "FriendlyName": obj.get("FriendlyName"),
            "ImportFavoritesOnly": obj.get("ImportFavoritesOnly"),
            "AllowHWTranscoding": obj.get("AllowHWTranscoding"),
            "AllowFmp4TranscodingContainer": obj.get("AllowFmp4TranscodingContainer"),
            "AllowStreamSharing": obj.get("AllowStreamSharing"),
            "FallbackMaxStreamingBitrate": obj.get("FallbackMaxStreamingBitrate"),
            "EnableStreamLooping": obj.get("EnableStreamLooping"),
            "Source": obj.get("Source"),
            "TunerCount": obj.get("TunerCount"),
            "UserAgent": obj.get("UserAgent"),
            "IgnoreDts": obj.get("IgnoreDts"),
            "ReadAtNativeFramerate": obj.get("ReadAtNativeFramerate")
        })
        return _obj


