# coding: utf-8

"""
    Ephor.ai

    Collaborative AI

    The version of the OpenAPI document: 1.3.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, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class InteractRequest(BaseModel):
    """
    InteractRequest
    """ # noqa: E501
    channel_id: StrictStr
    message_id: StrictStr
    interested_users: List[StrictStr]
    parent_id: StrictStr
    query: StrictStr
    top_k: Optional[StrictInt] = None
    past_messages: Optional[List[Dict[str, StrictStr]]] = None
    attachments: Optional[List[Dict[str, Any]]] = None
    lm_type: Optional[StrictStr] = 'groq-70'
    expert_type: Optional[StrictStr] = None
    metadata: Optional[Dict[str, Any]] = None
    account_id: Optional[StrictStr] = None
    project_id: Optional[StrictStr] = None
    library_id: Optional[StrictStr] = None
    shared_context: Optional[StrictBool] = None
    custom_instructions: Optional[StrictStr] = None
    profile_context: Optional[StrictStr] = None
    spov_context: Optional[StrictStr] = None
    search_on_x_options: Optional[Dict[str, Any]] = None
    expert_mode: Optional[StrictBool] = None
    pro_mode: Optional[StrictBool] = None
    selected_mode: Optional[StrictStr] = None
    selected_sources: Optional[List[StrictStr]] = None
    selected_models: Optional[List[StrictStr]] = None
    generate_expert_comments: Optional[StrictBool] = None
    selected_expert_comments: Optional[List[StrictStr]] = None
    debate_mode: Optional[StrictBool] = None
    debate_options: Optional[Dict[str, Any]] = None
    __properties: ClassVar[List[str]] = ["channel_id", "message_id", "interested_users", "parent_id", "query", "top_k", "past_messages", "attachments", "lm_type", "expert_type", "metadata", "account_id", "project_id", "library_id", "shared_context", "custom_instructions", "profile_context", "spov_context", "search_on_x_options", "expert_mode", "pro_mode", "selected_mode", "selected_sources", "selected_models", "generate_expert_comments", "selected_expert_comments", "debate_mode", "debate_options"]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "channel_id": obj.get("channel_id"),
            "message_id": obj.get("message_id"),
            "interested_users": obj.get("interested_users"),
            "parent_id": obj.get("parent_id"),
            "query": obj.get("query"),
            "top_k": obj.get("top_k"),
            "past_messages": obj.get("past_messages"),
            "attachments": obj.get("attachments"),
            "lm_type": obj.get("lm_type") if obj.get("lm_type") is not None else 'groq-70',
            "expert_type": obj.get("expert_type"),
            "metadata": obj.get("metadata"),
            "account_id": obj.get("account_id"),
            "project_id": obj.get("project_id"),
            "library_id": obj.get("library_id"),
            "shared_context": obj.get("shared_context"),
            "custom_instructions": obj.get("custom_instructions"),
            "profile_context": obj.get("profile_context"),
            "spov_context": obj.get("spov_context"),
            "search_on_x_options": obj.get("search_on_x_options"),
            "expert_mode": obj.get("expert_mode"),
            "pro_mode": obj.get("pro_mode"),
            "selected_mode": obj.get("selected_mode"),
            "selected_sources": obj.get("selected_sources"),
            "selected_models": obj.get("selected_models"),
            "generate_expert_comments": obj.get("generate_expert_comments"),
            "selected_expert_comments": obj.get("selected_expert_comments"),
            "debate_mode": obj.get("debate_mode"),
            "debate_options": obj.get("debate_options")
        })
        return _obj


