from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass, field
from kiota_abstractions.serialization import Parsable, ParseNode, SerializationWriter
from typing import Any, Optional, TYPE_CHECKING, Union

if TYPE_CHECKING:
    from .me_get_response_permitted_actions_transitions_state_from import MeGetResponse_permittedActions_transitions_stateFrom
    from .me_get_response_permitted_actions_transitions_state_to import MeGetResponse_permittedActions_transitions_stateTo

@dataclass
class MeGetResponse_permittedActions_transitions(Parsable):
    # Not relevant
    action_id: Optional[str] = None
    # The ID of the transition in the format ``from-state::to-state``. Possible values: ``create::mgr-1``, ``create::sbc-1``.
    id: Optional[str] = None
    # A list of required fields for the transition. For example, [``responseId``].
    mandatory_fields: Optional[list[str]] = None
    # The descriptive name of the transition. Possible values: ``Create``, ``Send to Manager``, ``Send to void``.
    name: Optional[str] = None
    # The starting state of the transition.
    state_from: Optional[MeGetResponse_permittedActions_transitions_stateFrom] = None
    # The target state of the transition.
    state_to: Optional[MeGetResponse_permittedActions_transitions_stateTo] = None
    # Fields that are used in the transition. For example, [``subcontractor``, ``subcontractorType``, ``watchers``, ``responseId``].
    transition_fields: Optional[list[str]] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> MeGetResponse_permittedActions_transitions:
        """
        Creates a new instance of the appropriate class based on discriminator value
        param parse_node: The parse node to use to read the discriminator value and create the object
        Returns: MeGetResponse_permittedActions_transitions
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return MeGetResponse_permittedActions_transitions()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .me_get_response_permitted_actions_transitions_state_from import MeGetResponse_permittedActions_transitions_stateFrom
        from .me_get_response_permitted_actions_transitions_state_to import MeGetResponse_permittedActions_transitions_stateTo

        from .me_get_response_permitted_actions_transitions_state_from import MeGetResponse_permittedActions_transitions_stateFrom
        from .me_get_response_permitted_actions_transitions_state_to import MeGetResponse_permittedActions_transitions_stateTo

        fields: dict[str, Callable[[Any], None]] = {
            "actionId": lambda n : setattr(self, 'action_id', n.get_str_value()),
            "id": lambda n : setattr(self, 'id', n.get_str_value()),
            "mandatoryFields": lambda n : setattr(self, 'mandatory_fields', n.get_collection_of_primitive_values(str)),
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "stateFrom": lambda n : setattr(self, 'state_from', n.get_object_value(MeGetResponse_permittedActions_transitions_stateFrom)),
            "stateTo": lambda n : setattr(self, 'state_to', n.get_object_value(MeGetResponse_permittedActions_transitions_stateTo)),
            "transitionFields": lambda n : setattr(self, 'transition_fields', n.get_collection_of_primitive_values(str)),
        }
        return fields
    
    def serialize(self,writer: SerializationWriter) -> None:
        """
        Serializes information the current object
        param writer: Serialization writer to use to serialize this model
        Returns: None
        """
        if writer is None:
            raise TypeError("writer cannot be null.")
        writer.write_str_value("actionId", self.action_id)
        writer.write_str_value("id", self.id)
        writer.write_collection_of_primitive_values("mandatoryFields", self.mandatory_fields)
        writer.write_str_value("name", self.name)
        writer.write_object_value("stateFrom", self.state_from)
        writer.write_object_value("stateTo", self.state_to)
        writer.write_collection_of_primitive_values("transitionFields", self.transition_fields)
    

