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 .workflow_get_response_project_roles_mapping import WorkflowGetResponse_projectRolesMapping
    from .workflow_get_response_workflow_type import WorkflowGetResponse_workflowType

@dataclass
class WorkflowGetResponse(Parsable):
    # A description of the workflow
    description: Optional[str] = None
    # A list of project roles and their corresponding permitted assignees.
    project_roles_mapping: Optional[list[WorkflowGetResponse_projectRolesMapping]] = None
    # The region type of the workflow. Possible values: ``US``, ``EU``.
    workflow_type: Optional[WorkflowGetResponse_workflowType] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WorkflowGetResponse:
        """
        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: WorkflowGetResponse
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WorkflowGetResponse()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .workflow_get_response_project_roles_mapping import WorkflowGetResponse_projectRolesMapping
        from .workflow_get_response_workflow_type import WorkflowGetResponse_workflowType

        from .workflow_get_response_project_roles_mapping import WorkflowGetResponse_projectRolesMapping
        from .workflow_get_response_workflow_type import WorkflowGetResponse_workflowType

        fields: dict[str, Callable[[Any], None]] = {
            "description": lambda n : setattr(self, 'description', n.get_str_value()),
            "projectRolesMapping": lambda n : setattr(self, 'project_roles_mapping', n.get_collection_of_object_values(WorkflowGetResponse_projectRolesMapping)),
            "workflowType": lambda n : setattr(self, 'workflow_type', n.get_enum_value(WorkflowGetResponse_workflowType)),
        }
        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("description", self.description)
        writer.write_collection_of_object_values("projectRolesMapping", self.project_roles_mapping)
        writer.write_enum_value("workflowType", self.workflow_type)
    

