# 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 pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from chat_server_connector_v2.models.course_public import CoursePublic
from chat_server_connector_v2.models.goal_engagement_preset_get import GoalEngagementPresetGet
from chat_server_connector_v2.models.goal_interactions_summary import GoalInteractionsSummary
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python

class AiAssistantGoalGet(BaseModel):
    """
    AiAssistantGoalGet
    """ # noqa: E501
    additional_prompt: StrictStr
    ai_assistant_id: StrictInt
    course_ids: List[StrictInt]
    created_at: StrictInt
    engagement: StrictInt
    engagement_opt_out_duration: StrictInt
    engagement_preset: Optional[GoalEngagementPresetGet] = None
    engagement_preset_id: Optional[StrictInt] = None
    id: StrictInt
    interactions_summary: Optional[GoalInteractionsSummary] = None
    is_active: StrictBool
    is_fullfilled: Optional[StrictBool] = False
    last_updated_at: StrictInt
    max_engagement_count: StrictInt
    max_engagement_period: StrictInt
    max_total_engagement_count: StrictInt
    name: StrictStr
    page_url: Optional[StrictStr] = None
    primary_course: Optional[CoursePublic] = None
    primary_course_id: Optional[StrictInt] = None
    __properties: ClassVar[List[str]] = ["additional_prompt", "ai_assistant_id", "course_ids", "created_at", "engagement", "engagement_opt_out_duration", "engagement_preset", "engagement_preset_id", "id", "interactions_summary", "is_active", "is_fullfilled", "last_updated_at", "max_engagement_count", "max_engagement_period", "max_total_engagement_count", "name", "page_url", "primary_course", "primary_course_id"]

    model_config = ConfigDict(
        validate_by_name=True,
        validate_by_alias=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"""
        return json.dumps(to_jsonable_python(self.to_dict()))

    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """Create an instance of AiAssistantGoalGet 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 engagement_preset
        if self.engagement_preset:
            _dict['engagement_preset'] = self.engagement_preset.to_dict()
        # override the default output from pydantic by calling `to_dict()` of interactions_summary
        if self.interactions_summary:
            _dict['interactions_summary'] = self.interactions_summary.to_dict()
        # override the default output from pydantic by calling `to_dict()` of primary_course
        if self.primary_course:
            _dict['primary_course'] = self.primary_course.to_dict()
        return _dict

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

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

        _obj = cls.model_validate({
            "additional_prompt": obj.get("additional_prompt"),
            "ai_assistant_id": obj.get("ai_assistant_id"),
            "course_ids": obj.get("course_ids"),
            "created_at": obj.get("created_at"),
            "engagement": obj.get("engagement"),
            "engagement_opt_out_duration": obj.get("engagement_opt_out_duration"),
            "engagement_preset": GoalEngagementPresetGet.from_dict(obj["engagement_preset"]) if obj.get("engagement_preset") is not None else None,
            "engagement_preset_id": obj.get("engagement_preset_id"),
            "id": obj.get("id"),
            "interactions_summary": GoalInteractionsSummary.from_dict(obj["interactions_summary"]) if obj.get("interactions_summary") is not None else None,
            "is_active": obj.get("is_active"),
            "is_fullfilled": obj.get("is_fullfilled") if obj.get("is_fullfilled") is not None else False,
            "last_updated_at": obj.get("last_updated_at"),
            "max_engagement_count": obj.get("max_engagement_count"),
            "max_engagement_period": obj.get("max_engagement_period"),
            "max_total_engagement_count": obj.get("max_total_engagement_count"),
            "name": obj.get("name"),
            "page_url": obj.get("page_url"),
            "primary_course": CoursePublic.from_dict(obj["primary_course"]) if obj.get("primary_course") is not None else None,
            "primary_course_id": obj.get("primary_course_id")
        })
        return _obj


