# coding: utf-8

"""
    FastAPI

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

    The version of the OpenAPI document: 0.1.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, Field, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from voiceos.models.agent_language import AgentLanguage
from voiceos.models.open_ai import OpenAI
from voiceos.models.transcriber import Transcriber
from voiceos.models.voice import Voice
from typing import Optional, Set
from typing_extensions import Self

class AgentResponse(BaseModel):
    """
    AgentResponse
    """ # noqa: E501
    name: StrictStr = Field(description="The name of the agent")
    initial_message: StrictStr = Field(description="The initial message of the agent")
    prompt: StrictStr = Field(description="The prompt of the agent")
    language: Optional[AgentLanguage] = Field(default=None, description="DO NOT USE! Deprecated!")
    language_model: Optional[OpenAI] = None
    voice: Optional[Voice] = None
    transcriber: Optional[Transcriber] = None
    max_call_duration: Optional[StrictInt] = Field(default=600, description="The maximum call duration in seconds. If null, the call can be of any duration. The default value is 10 min.")
    id: StrictStr = Field(description="The id of the agent")
    uri: StrictStr = Field(description="The uri of the agent")
    account_id: StrictStr = Field(description="The id of the owner of the agent")
    created_at: datetime = Field(description="The date and time the agent was created")
    updated_at: datetime = Field(description="The date and time the agent was last updated")
    __properties: ClassVar[List[str]] = ["name", "initial_message", "prompt", "language", "language_model", "voice", "transcriber", "max_call_duration", "id", "uri", "account_id", "created_at", "updated_at"]

    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 AgentResponse 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,
        )
        # override the default output from pydantic by calling `to_dict()` of language_model
        if self.language_model:
            _dict['language_model'] = self.language_model.to_dict()
        # override the default output from pydantic by calling `to_dict()` of voice
        if self.voice:
            _dict['voice'] = self.voice.to_dict()
        # override the default output from pydantic by calling `to_dict()` of transcriber
        if self.transcriber:
            _dict['transcriber'] = self.transcriber.to_dict()
        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of AgentResponse 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"),
            "initial_message": obj.get("initial_message"),
            "prompt": obj.get("prompt"),
            "language": obj.get("language"),
            "language_model": OpenAI.from_dict(obj["language_model"]) if obj.get("language_model") is not None else None,
            "voice": Voice.from_dict(obj["voice"]) if obj.get("voice") is not None else None,
            "transcriber": Transcriber.from_dict(obj["transcriber"]) if obj.get("transcriber") is not None else None,
            "max_call_duration": obj.get("max_call_duration") if obj.get("max_call_duration") is not None else 600,
            "id": obj.get("id"),
            "uri": obj.get("uri"),
            "account_id": obj.get("account_id"),
            "created_at": obj.get("created_at"),
            "updated_at": obj.get("updated_at")
        })
        return _obj


