# coding: utf-8

"""
    Giphy API

    Giphy API

    The version of the OpenAPI document: 1.0
    Contact: support@giphy.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 pydantic import BaseModel, ConfigDict
from typing import Any, ClassVar, Dict, List, Optional
from tester_sdk.models.gif_images_downsized import GifImagesDownsized
from tester_sdk.models.gif_images_downsized_large import GifImagesDownsizedLarge
from tester_sdk.models.gif_images_downsized_medium import GifImagesDownsizedMedium
from tester_sdk.models.gif_images_downsized_small import GifImagesDownsizedSmall
from tester_sdk.models.gif_images_downsized_still import GifImagesDownsizedStill
from tester_sdk.models.gif_images_fixed_height import GifImagesFixedHeight
from tester_sdk.models.gif_images_fixed_height_downsampled import GifImagesFixedHeightDownsampled
from tester_sdk.models.gif_images_fixed_height_small import GifImagesFixedHeightSmall
from tester_sdk.models.gif_images_fixed_height_small_still import GifImagesFixedHeightSmallStill
from tester_sdk.models.gif_images_fixed_height_still import GifImagesFixedHeightStill
from tester_sdk.models.gif_images_fixed_width import GifImagesFixedWidth
from tester_sdk.models.gif_images_fixed_width_downsampled import GifImagesFixedWidthDownsampled
from tester_sdk.models.gif_images_fixed_width_small import GifImagesFixedWidthSmall
from tester_sdk.models.gif_images_fixed_width_small_still import GifImagesFixedWidthSmallStill
from tester_sdk.models.gif_images_fixed_width_still import GifImagesFixedWidthStill
from tester_sdk.models.gif_images_looping import GifImagesLooping
from tester_sdk.models.gif_images_original import GifImagesOriginal
from tester_sdk.models.gif_images_original_still import GifImagesOriginalStill
from tester_sdk.models.gif_images_preview import GifImagesPreview
from tester_sdk.models.gif_images_preview_gif import GifImagesPreviewGif
from typing import Optional, Set
from typing_extensions import Self

class GifImages(BaseModel):
    """
    An object containing data for various available formats and sizes of this GIF.
    """ # noqa: E501
    downsized: Optional[GifImagesDownsized] = None
    downsized_large: Optional[GifImagesDownsizedLarge] = None
    downsized_medium: Optional[GifImagesDownsizedMedium] = None
    downsized_small: Optional[GifImagesDownsizedSmall] = None
    downsized_still: Optional[GifImagesDownsizedStill] = None
    fixed_height: Optional[GifImagesFixedHeight] = None
    fixed_height_downsampled: Optional[GifImagesFixedHeightDownsampled] = None
    fixed_height_small: Optional[GifImagesFixedHeightSmall] = None
    fixed_height_small_still: Optional[GifImagesFixedHeightSmallStill] = None
    fixed_height_still: Optional[GifImagesFixedHeightStill] = None
    fixed_width: Optional[GifImagesFixedWidth] = None
    fixed_width_downsampled: Optional[GifImagesFixedWidthDownsampled] = None
    fixed_width_small: Optional[GifImagesFixedWidthSmall] = None
    fixed_width_small_still: Optional[GifImagesFixedWidthSmallStill] = None
    fixed_width_still: Optional[GifImagesFixedWidthStill] = None
    looping: Optional[GifImagesLooping] = None
    original: Optional[GifImagesOriginal] = None
    original_still: Optional[GifImagesOriginalStill] = None
    preview: Optional[GifImagesPreview] = None
    preview_gif: Optional[GifImagesPreviewGif] = None
    __properties: ClassVar[List[str]] = ["downsized", "downsized_large", "downsized_medium", "downsized_small", "downsized_still", "fixed_height", "fixed_height_downsampled", "fixed_height_small", "fixed_height_small_still", "fixed_height_still", "fixed_width", "fixed_width_downsampled", "fixed_width_small", "fixed_width_small_still", "fixed_width_still", "looping", "original", "original_still", "preview", "preview_gif"]

    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 GifImages 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 downsized
        if self.downsized:
            _dict['downsized'] = self.downsized.to_dict()
        # override the default output from pydantic by calling `to_dict()` of downsized_large
        if self.downsized_large:
            _dict['downsized_large'] = self.downsized_large.to_dict()
        # override the default output from pydantic by calling `to_dict()` of downsized_medium
        if self.downsized_medium:
            _dict['downsized_medium'] = self.downsized_medium.to_dict()
        # override the default output from pydantic by calling `to_dict()` of downsized_small
        if self.downsized_small:
            _dict['downsized_small'] = self.downsized_small.to_dict()
        # override the default output from pydantic by calling `to_dict()` of downsized_still
        if self.downsized_still:
            _dict['downsized_still'] = self.downsized_still.to_dict()
        # override the default output from pydantic by calling `to_dict()` of fixed_height
        if self.fixed_height:
            _dict['fixed_height'] = self.fixed_height.to_dict()
        # override the default output from pydantic by calling `to_dict()` of fixed_height_downsampled
        if self.fixed_height_downsampled:
            _dict['fixed_height_downsampled'] = self.fixed_height_downsampled.to_dict()
        # override the default output from pydantic by calling `to_dict()` of fixed_height_small
        if self.fixed_height_small:
            _dict['fixed_height_small'] = self.fixed_height_small.to_dict()
        # override the default output from pydantic by calling `to_dict()` of fixed_height_small_still
        if self.fixed_height_small_still:
            _dict['fixed_height_small_still'] = self.fixed_height_small_still.to_dict()
        # override the default output from pydantic by calling `to_dict()` of fixed_height_still
        if self.fixed_height_still:
            _dict['fixed_height_still'] = self.fixed_height_still.to_dict()
        # override the default output from pydantic by calling `to_dict()` of fixed_width
        if self.fixed_width:
            _dict['fixed_width'] = self.fixed_width.to_dict()
        # override the default output from pydantic by calling `to_dict()` of fixed_width_downsampled
        if self.fixed_width_downsampled:
            _dict['fixed_width_downsampled'] = self.fixed_width_downsampled.to_dict()
        # override the default output from pydantic by calling `to_dict()` of fixed_width_small
        if self.fixed_width_small:
            _dict['fixed_width_small'] = self.fixed_width_small.to_dict()
        # override the default output from pydantic by calling `to_dict()` of fixed_width_small_still
        if self.fixed_width_small_still:
            _dict['fixed_width_small_still'] = self.fixed_width_small_still.to_dict()
        # override the default output from pydantic by calling `to_dict()` of fixed_width_still
        if self.fixed_width_still:
            _dict['fixed_width_still'] = self.fixed_width_still.to_dict()
        # override the default output from pydantic by calling `to_dict()` of looping
        if self.looping:
            _dict['looping'] = self.looping.to_dict()
        # override the default output from pydantic by calling `to_dict()` of original
        if self.original:
            _dict['original'] = self.original.to_dict()
        # override the default output from pydantic by calling `to_dict()` of original_still
        if self.original_still:
            _dict['original_still'] = self.original_still.to_dict()
        # override the default output from pydantic by calling `to_dict()` of preview
        if self.preview:
            _dict['preview'] = self.preview.to_dict()
        # override the default output from pydantic by calling `to_dict()` of preview_gif
        if self.preview_gif:
            _dict['preview_gif'] = self.preview_gif.to_dict()
        return _dict

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

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

        _obj = cls.model_validate({
            "downsized": GifImagesDownsized.from_dict(obj["downsized"]) if obj.get("downsized") is not None else None,
            "downsized_large": GifImagesDownsizedLarge.from_dict(obj["downsized_large"]) if obj.get("downsized_large") is not None else None,
            "downsized_medium": GifImagesDownsizedMedium.from_dict(obj["downsized_medium"]) if obj.get("downsized_medium") is not None else None,
            "downsized_small": GifImagesDownsizedSmall.from_dict(obj["downsized_small"]) if obj.get("downsized_small") is not None else None,
            "downsized_still": GifImagesDownsizedStill.from_dict(obj["downsized_still"]) if obj.get("downsized_still") is not None else None,
            "fixed_height": GifImagesFixedHeight.from_dict(obj["fixed_height"]) if obj.get("fixed_height") is not None else None,
            "fixed_height_downsampled": GifImagesFixedHeightDownsampled.from_dict(obj["fixed_height_downsampled"]) if obj.get("fixed_height_downsampled") is not None else None,
            "fixed_height_small": GifImagesFixedHeightSmall.from_dict(obj["fixed_height_small"]) if obj.get("fixed_height_small") is not None else None,
            "fixed_height_small_still": GifImagesFixedHeightSmallStill.from_dict(obj["fixed_height_small_still"]) if obj.get("fixed_height_small_still") is not None else None,
            "fixed_height_still": GifImagesFixedHeightStill.from_dict(obj["fixed_height_still"]) if obj.get("fixed_height_still") is not None else None,
            "fixed_width": GifImagesFixedWidth.from_dict(obj["fixed_width"]) if obj.get("fixed_width") is not None else None,
            "fixed_width_downsampled": GifImagesFixedWidthDownsampled.from_dict(obj["fixed_width_downsampled"]) if obj.get("fixed_width_downsampled") is not None else None,
            "fixed_width_small": GifImagesFixedWidthSmall.from_dict(obj["fixed_width_small"]) if obj.get("fixed_width_small") is not None else None,
            "fixed_width_small_still": GifImagesFixedWidthSmallStill.from_dict(obj["fixed_width_small_still"]) if obj.get("fixed_width_small_still") is not None else None,
            "fixed_width_still": GifImagesFixedWidthStill.from_dict(obj["fixed_width_still"]) if obj.get("fixed_width_still") is not None else None,
            "looping": GifImagesLooping.from_dict(obj["looping"]) if obj.get("looping") is not None else None,
            "original": GifImagesOriginal.from_dict(obj["original"]) if obj.get("original") is not None else None,
            "original_still": GifImagesOriginalStill.from_dict(obj["original_still"]) if obj.get("original_still") is not None else None,
            "preview": GifImagesPreview.from_dict(obj["preview"]) if obj.get("preview") is not None else None,
            "preview_gif": GifImagesPreviewGif.from_dict(obj["preview_gif"]) if obj.get("preview_gif") is not None else None
        })
        return _obj


