# 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.course_public import CoursePublic
from ai_assistant_server_connector.models.goal_engagement_preset_get import GoalEngagementPresetGet
from ai_assistant_server_connector.models.goal_interactions_summary import GoalInteractionsSummary

class AiAssistantGoalGet(BaseModel):
    """
    AiAssistantGoalGet
    """
    additional_prompt: StrictStr = Field(...)
    ai_assistant_id: StrictInt = Field(...)
    course_ids: conlist(StrictInt) = Field(...)
    created_at: StrictInt = Field(...)
    engagement: StrictInt = Field(...)
    engagement_opt_out_duration: StrictInt = Field(...)
    engagement_preset: Optional[GoalEngagementPresetGet] = None
    engagement_preset_id: Optional[StrictInt] = None
    id: StrictInt = Field(...)
    interactions_summary: Optional[GoalInteractionsSummary] = None
    is_active: StrictBool = Field(...)
    is_fullfilled: Optional[StrictBool] = False
    last_updated_at: StrictInt = Field(...)
    max_engagement_count: StrictInt = Field(...)
    max_engagement_period: StrictInt = Field(...)
    max_total_engagement_count: StrictInt = Field(...)
    name: StrictStr = Field(...)
    page_url: Optional[StrictStr] = None
    primary_course: Optional[CoursePublic] = None
    primary_course_id: Optional[StrictInt] = None
    __properties = ["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"]

    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) -> AiAssistantGoalGet:
        """Create an instance of AiAssistantGoalGet 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 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: dict) -> AiAssistantGoalGet:
        """Create an instance of AiAssistantGoalGet from a dict"""
        if obj is None:
            return None

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

        _obj = AiAssistantGoalGet.parse_obj({
            "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.get("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.get("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.get("primary_course")) if obj.get("primary_course") is not None else None,
            "primary_course_id": obj.get("primary_course_id")
        })
        return _obj


