# coding: utf-8

"""
    Mentortools AI API

    Mentortools service for ai interactions

    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 ai_assistant_server_connector.models.ai_assistant_goal_create import AiAssistantGoalCreate
from ai_assistant_server_connector.models.ai_assistant_lexicon_item_new import AiAssistantLexiconItemNew
from ai_assistant_server_connector.models.assistant_function import AssistantFunction
from ai_assistant_server_connector.models.conversation_style import ConversationStyle

class AiAssistantNew(BaseModel):
    """
    AiAssistantNew
    """
    allow_text: Optional[StrictBool] = True
    allow_voice: Optional[StrictBool] = False
    approved_urls: Optional[conlist(StrictStr)] = None
    avatar_id: Optional[StrictStr] = None
    banned_keywords: Optional[conlist(StrictStr)] = None
    conversation_starter: Optional[StrictStr] = None
    conversation_style: Optional[ConversationStyle] = None
    function: Optional[AssistantFunction] = None
    goals: Optional[conlist(AiAssistantGoalCreate)] = None
    is_active: Optional[StrictBool] = True
    is_live: Optional[StrictBool] = True
    lexicon_items: Optional[conlist(AiAssistantLexiconItemNew)] = None
    name: StrictStr = Field(...)
    prefer_voice: Optional[StrictBool] = False
    system_prompt_support: Optional[StrictStr] = None
    system_prompt_tutor: Optional[StrictStr] = None
    voice_id: Optional[StrictInt] = 1
    __properties = ["allow_text", "allow_voice", "approved_urls", "avatar_id", "banned_keywords", "conversation_starter", "conversation_style", "function", "goals", "is_active", "is_live", "lexicon_items", "name", "prefer_voice", "system_prompt_support", "system_prompt_tutor", "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) -> AiAssistantNew:
        """Create an instance of AiAssistantNew 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 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) -> AiAssistantNew:
        """Create an instance of AiAssistantNew from a dict"""
        if obj is None:
            return None

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

        _obj = AiAssistantNew.parse_obj({
            "allow_text": obj.get("allow_text") if obj.get("allow_text") is not None else True,
            "allow_voice": obj.get("allow_voice") if obj.get("allow_voice") is not None else False,
            "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"),
            "function": obj.get("function"),
            "goals": [AiAssistantGoalCreate.from_dict(_item) for _item in obj.get("goals")] if obj.get("goals") is not None else None,
            "is_active": obj.get("is_active") if obj.get("is_active") is not None else True,
            "is_live": obj.get("is_live") if obj.get("is_live") is not None else True,
            "lexicon_items": [AiAssistantLexiconItemNew.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") if obj.get("prefer_voice") is not None else False,
            "system_prompt_support": obj.get("system_prompt_support"),
            "system_prompt_tutor": obj.get("system_prompt_tutor"),
            "voice_id": obj.get("voice_id") if obj.get("voice_id") is not None else 1
        })
        return _obj


