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
from uuid import UUID

if TYPE_CHECKING:
    from .me_get_response_external_users import MeGetResponse_externalUsers
    from .me_get_response_permitted_actions import MeGetResponse_permittedActions
    from .me_get_response_user import MeGetResponse_user
    from .me_get_response_workflow import MeGetResponse_workflow

@dataclass
class MeGetResponse(Parsable):
    # The ID of the default RFI type assigned to the project. This is the unique identifier of the RFI type that will be selected by default when creating a new RFI.
    default_rfi_type: Optional[UUID] = None
    # Not relevant
    external_users: Optional[list[MeGetResponse_externalUsers]] = None
    # Not relevant
    maintenance_end_date: Optional[str] = None
    # The list of actions that are permitted for the user.
    permitted_actions: Optional[list[MeGetResponse_permittedActions]] = None
    # The current user’s details.
    user: Optional[MeGetResponse_user] = None
    # The user’s assigned workflow roles and workflow type for RFIs in the current project.
    workflow: Optional[list[MeGetResponse_workflow]] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> MeGetResponse:
        """
        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
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return MeGetResponse()
    
    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_external_users import MeGetResponse_externalUsers
        from .me_get_response_permitted_actions import MeGetResponse_permittedActions
        from .me_get_response_user import MeGetResponse_user
        from .me_get_response_workflow import MeGetResponse_workflow

        from .me_get_response_external_users import MeGetResponse_externalUsers
        from .me_get_response_permitted_actions import MeGetResponse_permittedActions
        from .me_get_response_user import MeGetResponse_user
        from .me_get_response_workflow import MeGetResponse_workflow

        fields: dict[str, Callable[[Any], None]] = {
            "defaultRfiType": lambda n : setattr(self, 'default_rfi_type', n.get_uuid_value()),
            "externalUsers": lambda n : setattr(self, 'external_users', n.get_collection_of_object_values(MeGetResponse_externalUsers)),
            "maintenanceEndDate": lambda n : setattr(self, 'maintenance_end_date', n.get_str_value()),
            "permittedActions": lambda n : setattr(self, 'permitted_actions', n.get_collection_of_object_values(MeGetResponse_permittedActions)),
            "user": lambda n : setattr(self, 'user', n.get_object_value(MeGetResponse_user)),
            "workflow": lambda n : setattr(self, 'workflow', n.get_collection_of_object_values(MeGetResponse_workflow)),
        }
        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_uuid_value("defaultRfiType", self.default_rfi_type)
        writer.write_collection_of_object_values("externalUsers", self.external_users)
        writer.write_str_value("maintenanceEndDate", self.maintenance_end_date)
        writer.write_collection_of_object_values("permittedActions", self.permitted_actions)
        writer.write_object_value("user", self.user)
        writer.write_collection_of_object_values("workflow", self.workflow)
    

