# coding: utf-8

"""
Immich

Immich API

The version of the OpenAPI document: 2.4.1
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,
    StrictFloat,
    StrictInt,
    StrictStr,
)
from typing import Any, ClassVar, Dict, List, Optional, Union
from typing_extensions import Annotated
from immich.client.models.asset_visibility import AssetVisibility
from typing import Set
from typing_extensions import Self


class TimeBucketAssetResponseDto(BaseModel):
    """
    TimeBucketAssetResponseDto
    """  # noqa: E501

    city: List[Optional[StrictStr]] = Field(
        description="Array of city names extracted from EXIF GPS data"
    )
    country: List[Optional[StrictStr]] = Field(
        description="Array of country names extracted from EXIF GPS data"
    )
    duration: List[Optional[StrictStr]] = Field(
        description="Array of video durations in HH:MM:SS format (null for images)"
    )
    file_created_at: List[StrictStr] = Field(
        description="Array of file creation timestamps in UTC (ISO 8601 format, without timezone)",
        alias="fileCreatedAt",
    )
    id: List[StrictStr] = Field(description="Array of asset IDs in the time bucket")
    is_favorite: List[StrictBool] = Field(
        description="Array indicating whether each asset is favorited",
        alias="isFavorite",
    )
    is_image: List[StrictBool] = Field(
        description="Array indicating whether each asset is an image (false for videos)",
        alias="isImage",
    )
    is_trashed: List[StrictBool] = Field(
        description="Array indicating whether each asset is in the trash",
        alias="isTrashed",
    )
    latitude: Optional[List[Optional[Union[StrictFloat, StrictInt]]]] = Field(
        default=None,
        description="Array of latitude coordinates extracted from EXIF GPS data",
    )
    live_photo_video_id: List[Optional[StrictStr]] = Field(
        description="Array of live photo video asset IDs (null for non-live photos)",
        alias="livePhotoVideoId",
    )
    local_offset_hours: List[Union[StrictFloat, StrictInt]] = Field(
        description="Array of UTC offset hours at the time each photo was taken. Positive values are east of UTC, negative values are west of UTC. Values may be fractional (e.g., 5.5 for +05:30, -9.75 for -09:45). Applying this offset to 'fileCreatedAt' will give you the time the photo was taken from the photographer's perspective.",
        alias="localOffsetHours",
    )
    longitude: Optional[List[Optional[Union[StrictFloat, StrictInt]]]] = Field(
        default=None,
        description="Array of longitude coordinates extracted from EXIF GPS data",
    )
    owner_id: List[StrictStr] = Field(
        description="Array of owner IDs for each asset", alias="ownerId"
    )
    projection_type: List[Optional[StrictStr]] = Field(
        description='Array of projection types for 360° content (e.g., "EQUIRECTANGULAR", "CUBEFACE", "CYLINDRICAL")',
        alias="projectionType",
    )
    ratio: List[Union[StrictFloat, StrictInt]] = Field(
        description="Array of aspect ratios (width/height) for each asset"
    )
    stack: Optional[
        List[Optional[Annotated[List[StrictStr], Field(min_length=2, max_length=2)]]]
    ] = Field(
        default=None,
        description="Array of stack information as [stackId, assetCount] tuples (null for non-stacked assets)",
    )
    thumbhash: List[Optional[StrictStr]] = Field(
        description="Array of BlurHash strings for generating asset previews (base64 encoded)"
    )
    visibility: List[AssetVisibility] = Field(
        description="Array of visibility statuses for each asset (e.g., ARCHIVE, TIMELINE, HIDDEN, LOCKED)"
    )
    __properties: ClassVar[List[str]] = [
        "city",
        "country",
        "duration",
        "fileCreatedAt",
        "id",
        "isFavorite",
        "isImage",
        "isTrashed",
        "latitude",
        "livePhotoVideoId",
        "localOffsetHours",
        "longitude",
        "ownerId",
        "projectionType",
        "ratio",
        "stack",
        "thumbhash",
        "visibility",
    ]

    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 TimeBucketAssetResponseDto 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,
        )
        return _dict

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

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

        _obj = cls.model_validate(
            {
                "city": obj.get("city"),
                "country": obj.get("country"),
                "duration": obj.get("duration"),
                "fileCreatedAt": obj.get("fileCreatedAt"),
                "id": obj.get("id"),
                "isFavorite": obj.get("isFavorite"),
                "isImage": obj.get("isImage"),
                "isTrashed": obj.get("isTrashed"),
                "latitude": obj.get("latitude"),
                "livePhotoVideoId": obj.get("livePhotoVideoId"),
                "localOffsetHours": obj.get("localOffsetHours"),
                "longitude": obj.get("longitude"),
                "ownerId": obj.get("ownerId"),
                "projectionType": obj.get("projectionType"),
                "ratio": obj.get("ratio"),
                "stack": obj.get("stack"),
                "thumbhash": obj.get("thumbhash"),
                "visibility": obj.get("visibility"),
            }
        )
        return _obj
