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 .steps_get_response_results_permitted_actions_fields import StepsGetResponse_results_permittedActions_fields

@dataclass
class StepsGetResponse_results_permittedActions(Parsable):
    # A mapping of field names to lists of possible values for each field. If a field does not require a specific value, it will be returned as an empty array.
    fields: Optional[StepsGetResponse_results_permittedActions_fields] = None
    # The ID of the action in the format ``type_of_object::action``. For example, ``Step::partial_update``.
    id: Optional[str] = None
    # A list of fields required to perform specific actions on a step, such as ``tasks`` for the ``Step::partial_update`` action. The required fields depend on the user's role and the action.
    mandatory_fields: Optional[list[str]] = None
    # Not relevant
    transitions: Optional[list[str]] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> StepsGetResponse_results_permittedActions:
        """
        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: StepsGetResponse_results_permittedActions
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return StepsGetResponse_results_permittedActions()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .steps_get_response_results_permitted_actions_fields import StepsGetResponse_results_permittedActions_fields

        from .steps_get_response_results_permitted_actions_fields import StepsGetResponse_results_permittedActions_fields

        fields: dict[str, Callable[[Any], None]] = {
            "fields": lambda n : setattr(self, 'fields', n.get_object_value(StepsGetResponse_results_permittedActions_fields)),
            "id": lambda n : setattr(self, 'id', n.get_str_value()),
            "mandatoryFields": lambda n : setattr(self, 'mandatory_fields', n.get_collection_of_primitive_values(str)),
            "transitions": lambda n : setattr(self, 'transitions', 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_object_value("fields", self.fields)
        writer.write_str_value("id", self.id)
        writer.write_collection_of_primitive_values("mandatoryFields", self.mandatory_fields)
        writer.write_collection_of_primitive_values("transitions", self.transitions)
    

