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_issues import MeGetResponse_issues

@dataclass
class MeGetResponse(Parsable):
    # Not relevant
    can_manage_templates: Optional[bool] = None
    # The user's Autodesk ID.
    id: Optional[str] = None
    # States whether the current logged in user is a system admin.
    is_project_admin: Optional[bool] = None
    # The issues property
    issues: Optional[list[MeGetResponse_issues]] = None
    # The permission level of the user. Each permission level corresponds to a combination of values in the response. For example, a combination of ``read`` and ``create`` in the response, corresponds to a *Full visibility* permission level.Note that if a user with *View and assign issues for their company* permissions attempts to assign a user from a another company to the issue, it will return an error. In addition, the user can both create and view issues for their own company. You can also verify a user's assignment permissions by checking the ``permittedActions`` or ``permissionLevels`` attributes.- *Edit, view, and assign* This permission level is split into two sub-levels:- *View and assign to their company* (previously known as  *Create for my company*) : ``create`` and the ``permittedActions`` array must include ``assign-same-company``- *View issues for their company. Assign issues to anyone.* : ``create`` and the ``permittedActions`` array must include ``assign-all``- *Full visibility* (previously known as *Create for other companies*): ``create``, ``read``- *Manage issues*: ``create``, ``read``, ``write``Possible values: ``create``, ``read``, ``write``.For more details about the permission levels, see `Issues Permissions <https://help.autodesk.com/view/BUILD/ENU/?guid=Issues_Permissions>`_.
    permission_levels: 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_issues import MeGetResponse_issues

        from .me_get_response_issues import MeGetResponse_issues

        fields: dict[str, Callable[[Any], None]] = {
            "canManageTemplates": lambda n : setattr(self, 'can_manage_templates', n.get_bool_value()),
            "id": lambda n : setattr(self, 'id', n.get_str_value()),
            "isProjectAdmin": lambda n : setattr(self, 'is_project_admin', n.get_bool_value()),
            "issues": lambda n : setattr(self, 'issues', n.get_collection_of_object_values(MeGetResponse_issues)),
            "permissionLevels": lambda n : setattr(self, 'permission_levels', 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_bool_value("canManageTemplates", self.can_manage_templates)
        writer.write_str_value("id", self.id)
        writer.write_bool_value("isProjectAdmin", self.is_project_admin)
        writer.write_collection_of_object_values("issues", self.issues)
        writer.write_collection_of_primitive_values("permissionLevels", self.permission_levels)
    

