# coding: utf-8

"""
    Mentortools Chat API

    Mentortools service for chatting

    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 typing import List, Optional
from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, conlist
from chat_server_connector.models.ai_assistant_goal_get import AiAssistantGoalGet
from chat_server_connector.models.ai_assistant_lexicon_item import AiAssistantLexiconItem
from chat_server_connector.models.assistant_function import AssistantFunction
from chat_server_connector.models.assistant_type import AssistantType
from chat_server_connector.models.conversation_style import ConversationStyle
from chat_server_connector.models.knowledgebase_state import KnowledgebaseState

class AiAssistantGet(BaseModel):
    """
    AiAssistantGet  # noqa: E501
    """
    allow_text: StrictBool = Field(...)
    allow_voice: StrictBool = Field(...)
    approved_urls: conlist(StrictStr) = Field(...)
    avatar_id: Optional[StrictStr] = None
    banned_keywords: conlist(StrictStr) = Field(...)
    conversation_starter: Optional[StrictStr] = None
    conversation_style: ConversationStyle = Field(...)
    created_at: StrictInt = Field(...)
    deleted_at: Optional[StrictInt] = None
    function: AssistantFunction = Field(...)
    goals: Optional[conlist(AiAssistantGoalGet)] = None
    id: StrictInt = Field(...)
    is_active: StrictBool = Field(...)
    is_available: Optional[StrictBool] = False
    is_live: StrictBool = Field(...)
    knowledgebase_state: Optional[KnowledgebaseState] = None
    last_updated_at: StrictInt = Field(...)
    lexicon_items: Optional[conlist(AiAssistantLexiconItem)] = None
    name: StrictStr = Field(...)
    prefer_voice: StrictBool = Field(...)
    system_prompt: Optional[StrictStr] = None
    system_prompt_support: Optional[StrictStr] = None
    system_prompt_tutor: Optional[StrictStr] = None
    type: AssistantType = Field(...)
    voice_id: StrictInt = Field(...)
    __properties = ["allow_text", "allow_voice", "approved_urls", "avatar_id", "banned_keywords", "conversation_starter", "conversation_style", "created_at", "deleted_at", "function", "goals", "id", "is_active", "is_available", "is_live", "knowledgebase_state", "last_updated_at", "lexicon_items", "name", "prefer_voice", "system_prompt", "system_prompt_support", "system_prompt_tutor", "type", "voice_id"]

    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) -> AiAssistantGet:
        """Create an instance of AiAssistantGet 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 by calling `to_dict()` of each item in goals (list)
        _items = []
        if self.goals:
            for _item in self.goals:
                if _item:
                    _items.append(_item.to_dict())
            _dict['goals'] = _items
        # override the default output from pydantic by calling `to_dict()` of knowledgebase_state
        if self.knowledgebase_state:
            _dict['knowledgebase_state'] = self.knowledgebase_state.to_dict()
        # override the default output from pydantic by calling `to_dict()` of each item in lexicon_items (list)
        _items = []
        if self.lexicon_items:
            for _item in self.lexicon_items:
                if _item:
                    _items.append(_item.to_dict())
            _dict['lexicon_items'] = _items
        return _dict

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

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

        _obj = AiAssistantGet.parse_obj({
            "allow_text": obj.get("allow_text"),
            "allow_voice": obj.get("allow_voice"),
            "approved_urls": obj.get("approved_urls"),
            "avatar_id": obj.get("avatar_id"),
            "banned_keywords": obj.get("banned_keywords"),
            "conversation_starter": obj.get("conversation_starter"),
            "conversation_style": obj.get("conversation_style"),
            "created_at": obj.get("created_at"),
            "deleted_at": obj.get("deleted_at"),
            "function": obj.get("function"),
            "goals": [AiAssistantGoalGet.from_dict(_item) for _item in obj.get("goals")] if obj.get("goals") is not None else None,
            "id": obj.get("id"),
            "is_active": obj.get("is_active"),
            "is_available": obj.get("is_available") if obj.get("is_available") is not None else False,
            "is_live": obj.get("is_live"),
            "knowledgebase_state": KnowledgebaseState.from_dict(obj.get("knowledgebase_state")) if obj.get("knowledgebase_state") is not None else None,
            "last_updated_at": obj.get("last_updated_at"),
            "lexicon_items": [AiAssistantLexiconItem.from_dict(_item) for _item in obj.get("lexicon_items")] if obj.get("lexicon_items") is not None else None,
            "name": obj.get("name"),
            "prefer_voice": obj.get("prefer_voice"),
            "system_prompt": obj.get("system_prompt"),
            "system_prompt_support": obj.get("system_prompt_support"),
            "system_prompt_tutor": obj.get("system_prompt_tutor"),
            "type": obj.get("type"),
            "voice_id": obj.get("voice_id")
        })
        return _obj


