# coding: utf-8

"""
    asset-lake-api-server

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: 0.1
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations

import json
import pprint
import re  # noqa: F401
from typing import Optional

from pydantic.v1 import BaseModel, Field, StrictBool, StrictInt, StrictStr

from clients.asset_lake.models.asset_type import AssetType
from clients.asset_lake.models.data import Data
from clients.asset_lake.models.status import Status


class Asset(BaseModel):
    """
    Asset
    """

    asset_type: AssetType = Field(...)
    created_at: StrictStr = Field(...)
    data: Data = Field(...)
    description: StrictStr = Field(...)
    id: StrictStr = Field(...)
    is_public: Optional[StrictBool] = False
    name: StrictStr = Field(...)
    size_bytes: StrictInt = Field(...)
    status: Status = Field(...)
    status_details: StrictStr = Field(...)
    tenant_uuid: StrictStr = Field(...)
    __properties = [
        "asset_type",
        "created_at",
        "data",
        "description",
        "id",
        "is_public",
        "name",
        "size_bytes",
        "status",
        "status_details",
        "tenant_uuid",
    ]

    class Config:
        """Pydantic configuration"""

        allow_population_by_field_name = True
        validate_assignment = True

    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.dict(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> Asset:
        """Create an instance of Asset from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        _dict = self.dict(by_alias=True, exclude={}, exclude_none=True)
        # override the default output from pydantic.v1 by calling `to_dict()` of data
        if self.data:
            _dict["data"] = self.data.to_dict()
        return _dict

    @classmethod
    def from_dict(cls, obj: dict) -> Asset:
        """Create an instance of Asset from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return Asset.parse_obj(obj)

        _obj = Asset.parse_obj(
            {
                "asset_type": obj.get("asset_type"),
                "created_at": obj.get("created_at"),
                "data": Data.from_dict(obj.get("data"))
                if obj.get("data") is not None
                else None,
                "description": obj.get("description"),
                "id": obj.get("id"),
                "is_public": obj.get("is_public")
                if obj.get("is_public") is not None
                else False,
                "name": obj.get("name"),
                "size_bytes": obj.get("size_bytes"),
                "status": obj.get("status"),
                "status_details": obj.get("status_details"),
                "tenant_uuid": obj.get("tenant_uuid"),
            }
        )
        return _obj
