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 import MeGetResponse_permittedActions

@dataclass
class MeGetResponse(Parsable):
    # The AutodeskId for the current user.
    id: Optional[str] = None
    # A list of actions that the user is allowed to perform
    permitted_actions: Optional[list[MeGetResponse_permittedActions]] = None
    # The roles assigned to the user in Submittals. Possible values: ``1`` - ``Manager``, ``2`` - ``User``, ``4`` - ``Admin``
    roles: Optional[list[str]] = 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_permitted_actions import MeGetResponse_permittedActions

        from .me_get_response_permitted_actions import MeGetResponse_permittedActions

        fields: dict[str, Callable[[Any], None]] = {
            "id": lambda n : setattr(self, 'id', n.get_str_value()),
            "permittedActions": lambda n : setattr(self, 'permitted_actions', n.get_collection_of_object_values(MeGetResponse_permittedActions)),
            "roles": lambda n : setattr(self, 'roles', 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("id", self.id)
        writer.write_collection_of_object_values("permittedActions", self.permitted_actions)
        writer.write_collection_of_primitive_values("roles", self.roles)
    

