# 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 Any, List, Optional

from pydantic.v1 import BaseModel, Field, StrictStr, conlist

from clients.asset_lake.models.base_engine import BaseEngine
from clients.asset_lake.models.data_type import DataType
from clients.asset_lake.models.file_format import FileFormat


class TextualInversionData(BaseModel):
    """
    TextualInversionData
    """

    asset_type: Optional[Any] = None
    data_type: Optional[DataType] = None
    engine: BaseEngine = Field(...)
    file_format: Optional[FileFormat] = None
    trigger_words: Optional[conlist(StrictStr)] = None
    __properties = ["asset_type", "data_type", "engine", "file_format", "trigger_words"]

    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) -> TextualInversionData:
        """Create an instance of TextualInversionData 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)
        # set to None if asset_type (nullable) is None
        # and __fields_set__ contains the field
        if self.asset_type is None and "asset_type" in self.__fields_set__:
            _dict["asset_type"] = None

        return _dict

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

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

        _obj = TextualInversionData.parse_obj(
            {
                "asset_type": obj.get("asset_type"),
                "data_type": obj.get("data_type"),
                "engine": obj.get("engine"),
                "file_format": obj.get("file_format"),
                "trigger_words": obj.get("trigger_words"),
            }
        )
        return _obj
