# coding: utf-8

"""
    authentik

    Making authentication simple.

    The version of the OpenAPI document: 2024.2.2
    Contact: hello@goauthentik.io
    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 Any, Dict
from pydantic import BaseModel, Field, StrictStr
from authentik_client.models.flow_stage_binding import FlowStageBinding

class FlowInspectorPlan(BaseModel):
    """
    Serializer for an active FlowPlan  # noqa: E501
    """
    current_stage: FlowStageBinding = Field(...)
    next_planned_stage: FlowStageBinding = Field(...)
    plan_context: Dict[str, Any] = Field(..., description="Get the plan's context, sanitized")
    session_id: StrictStr = Field(..., description="Get a unique session ID")
    __properties = ["current_stage", "next_planned_stage", "plan_context", "session_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) -> FlowInspectorPlan:
        """Create an instance of FlowInspectorPlan 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={
                            "current_stage",
                            "next_planned_stage",
                            "plan_context",
                            "session_id",
                          },
                          exclude_none=True)
        # override the default output from pydantic by calling `to_dict()` of current_stage
        if self.current_stage:
            _dict['current_stage'] = self.current_stage.to_dict()
        # override the default output from pydantic by calling `to_dict()` of next_planned_stage
        if self.next_planned_stage:
            _dict['next_planned_stage'] = self.next_planned_stage.to_dict()
        return _dict

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

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

        _obj = FlowInspectorPlan.parse_obj({
            "current_stage": FlowStageBinding.from_dict(obj.get("current_stage")) if obj.get("current_stage") is not None else None,
            "next_planned_stage": FlowStageBinding.from_dict(obj.get("next_planned_stage")) if obj.get("next_planned_stage") is not None else None,
            "plan_context": obj.get("plan_context"),
            "session_id": obj.get("session_id")
        })
        return _obj


