# 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, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class ConfigImageTypes(BaseModel):
    """
    ConfigImageTypes
    """ # noqa: E501
    backdrop_sizes: Optional[List[StrictStr]] = Field(default=None, alias="BackdropSizes")
    base_url: Optional[StrictStr] = Field(default=None, alias="BaseUrl")
    logo_sizes: Optional[List[StrictStr]] = Field(default=None, alias="LogoSizes")
    poster_sizes: Optional[List[StrictStr]] = Field(default=None, alias="PosterSizes")
    profile_sizes: Optional[List[StrictStr]] = Field(default=None, alias="ProfileSizes")
    secure_base_url: Optional[StrictStr] = Field(default=None, alias="SecureBaseUrl")
    still_sizes: Optional[List[StrictStr]] = Field(default=None, alias="StillSizes")
    __properties: ClassVar[List[str]] = ["BackdropSizes", "BaseUrl", "LogoSizes", "PosterSizes", "ProfileSizes", "SecureBaseUrl", "StillSizes"]

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "BackdropSizes": obj.get("BackdropSizes"),
            "BaseUrl": obj.get("BaseUrl"),
            "LogoSizes": obj.get("LogoSizes"),
            "PosterSizes": obj.get("PosterSizes"),
            "ProfileSizes": obj.get("ProfileSizes"),
            "SecureBaseUrl": obj.get("SecureBaseUrl"),
            "StillSizes": obj.get("StillSizes")
        })
        return _obj


