# 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 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 MLModelUpdateSchema(BaseModel):
    """
    MLModelUpdateSchema
    """ # noqa: E501
    name: Optional[StrictStr] = None
    description: Optional[StrictStr] = None
    metadata: Optional[Dict[str, Any]] = None
    visibility: Optional[StrictStr] = None
    tags: Optional[List[StrictStr]] = None
    model_external_id: Optional[StrictStr] = None
    model_provider_name: Optional[StrictStr] = None
    mapped_model_id: Optional[StrictStr] = None
    output_format: Optional[StrictStr] = None
    deployment: Optional[StrictStr] = None
    can_take_video_as_input: Optional[StrictBool] = None
    can_take_audio_as_input: Optional[StrictBool] = None
    can_take_image_as_input: Optional[StrictBool] = None
    can_take_text_as_input: Optional[StrictBool] = None
    can_take_action_as_input: Optional[StrictBool] = None
    __properties: ClassVar[List[str]] = ["name", "description", "metadata", "visibility", "tags", "model_external_id", "model_provider_name", "mapped_model_id", "output_format", "deployment", "can_take_video_as_input", "can_take_audio_as_input", "can_take_image_as_input", "can_take_text_as_input", "can_take_action_as_input"]

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

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

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

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

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

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "name": obj.get("name"),
            "description": obj.get("description"),
            "metadata": obj.get("metadata"),
            "visibility": obj.get("visibility"),
            "tags": obj.get("tags"),
            "model_external_id": obj.get("model_external_id"),
            "model_provider_name": obj.get("model_provider_name"),
            "mapped_model_id": obj.get("mapped_model_id"),
            "output_format": obj.get("output_format"),
            "deployment": obj.get("deployment"),
            "can_take_video_as_input": obj.get("can_take_video_as_input"),
            "can_take_audio_as_input": obj.get("can_take_audio_as_input"),
            "can_take_image_as_input": obj.get("can_take_image_as_input"),
            "can_take_text_as_input": obj.get("can_take_text_as_input"),
            "can_take_action_as_input": obj.get("can_take_action_as_input")
        })
        return _obj


