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


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

    build: Optional[StrictStr] = None
    build_image: Optional[StrictStr] = Field(default=None, alias="buildImage")
    build_image_url: Optional[StrictStr] = Field(default=None, alias="buildImageUrl")
    build_url: Optional[StrictStr] = Field(default=None, alias="buildUrl")
    exiftool: Optional[StrictStr] = None
    ffmpeg: Optional[StrictStr] = None
    imagemagick: Optional[StrictStr] = None
    libvips: Optional[StrictStr] = None
    licensed: StrictBool
    nodejs: Optional[StrictStr] = None
    repository: Optional[StrictStr] = None
    repository_url: Optional[StrictStr] = Field(default=None, alias="repositoryUrl")
    source_commit: Optional[StrictStr] = Field(default=None, alias="sourceCommit")
    source_ref: Optional[StrictStr] = Field(default=None, alias="sourceRef")
    source_url: Optional[StrictStr] = Field(default=None, alias="sourceUrl")
    third_party_bug_feature_url: Optional[StrictStr] = Field(
        default=None, alias="thirdPartyBugFeatureUrl"
    )
    third_party_documentation_url: Optional[StrictStr] = Field(
        default=None, alias="thirdPartyDocumentationUrl"
    )
    third_party_source_url: Optional[StrictStr] = Field(
        default=None, alias="thirdPartySourceUrl"
    )
    third_party_support_url: Optional[StrictStr] = Field(
        default=None, alias="thirdPartySupportUrl"
    )
    version: StrictStr
    version_url: StrictStr = Field(alias="versionUrl")
    __properties: ClassVar[List[str]] = [
        "build",
        "buildImage",
        "buildImageUrl",
        "buildUrl",
        "exiftool",
        "ffmpeg",
        "imagemagick",
        "libvips",
        "licensed",
        "nodejs",
        "repository",
        "repositoryUrl",
        "sourceCommit",
        "sourceRef",
        "sourceUrl",
        "thirdPartyBugFeatureUrl",
        "thirdPartyDocumentationUrl",
        "thirdPartySourceUrl",
        "thirdPartySupportUrl",
        "version",
        "versionUrl",
    ]

    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 ServerAboutResponseDto 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 ServerAboutResponseDto from a dict"""
        if obj is None:
            return None

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

        _obj = cls.model_validate(
            {
                "build": obj.get("build"),
                "buildImage": obj.get("buildImage"),
                "buildImageUrl": obj.get("buildImageUrl"),
                "buildUrl": obj.get("buildUrl"),
                "exiftool": obj.get("exiftool"),
                "ffmpeg": obj.get("ffmpeg"),
                "imagemagick": obj.get("imagemagick"),
                "libvips": obj.get("libvips"),
                "licensed": obj.get("licensed"),
                "nodejs": obj.get("nodejs"),
                "repository": obj.get("repository"),
                "repositoryUrl": obj.get("repositoryUrl"),
                "sourceCommit": obj.get("sourceCommit"),
                "sourceRef": obj.get("sourceRef"),
                "sourceUrl": obj.get("sourceUrl"),
                "thirdPartyBugFeatureUrl": obj.get("thirdPartyBugFeatureUrl"),
                "thirdPartyDocumentationUrl": obj.get("thirdPartyDocumentationUrl"),
                "thirdPartySourceUrl": obj.get("thirdPartySourceUrl"),
                "thirdPartySupportUrl": obj.get("thirdPartySupportUrl"),
                "version": obj.get("version"),
                "versionUrl": obj.get("versionUrl"),
            }
        )
        return _obj
