# coding: utf-8

"""
    Cyberwave API

    Cyberwave platform REST API. Use 'Bearer YOUR_TOKEN' for authentication.

    The version of the OpenAPI document: 1.0.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 datetime import datetime
from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class AssetSchema(BaseModel):
    """
    AssetSchema
    """ # noqa: E501
    uuid: StrictStr
    name: StrictStr
    description: StrictStr
    created_at: datetime
    updated_at: datetime
    public: StrictBool
    visibility: Optional[StrictStr] = None
    owner_uuid: Optional[StrictStr] = None
    registry_id: Optional[StrictStr] = None
    glb_file: Optional[StrictStr]
    urdf_file: Optional[StrictStr]
    organization_uuid: Optional[StrictStr]
    metadata: Optional[Dict[str, Any]] = None
    kinematics: Optional[Dict[str, Any]] = None
    thumbnail: Optional[StrictStr] = None
    __properties: ClassVar[List[str]] = ["uuid", "name", "description", "created_at", "updated_at", "public", "visibility", "owner_uuid", "registry_id", "glb_file", "urdf_file", "organization_uuid", "metadata", "kinematics", "thumbnail"]

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

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

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "uuid": obj.get("uuid"),
            "name": obj.get("name"),
            "description": obj.get("description"),
            "created_at": obj.get("created_at"),
            "updated_at": obj.get("updated_at"),
            "public": obj.get("public"),
            "visibility": obj.get("visibility"),
            "owner_uuid": obj.get("owner_uuid"),
            "registry_id": obj.get("registry_id"),
            "glb_file": obj.get("glb_file"),
            "urdf_file": obj.get("urdf_file"),
            "organization_uuid": obj.get("organization_uuid"),
            "metadata": obj.get("metadata"),
            "kinematics": obj.get("kinematics"),
            "thumbnail": obj.get("thumbnail")
        })
        return _obj


