from __future__ import annotations
import datetime
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 .mappings_get_response_results_submittals_role import MappingsGetResponse_results_submittalsRole
    from .mappings_get_response_results_user_type import MappingsGetResponse_results_userType

@dataclass
class MappingsGetResponse_results(Parsable):
    # The Autodesk ID of the user (``autodeskId``), role (``memberGroupId``), or company (``memberGroupId``).To find details about users, call `GET users </en/docs/acc/v1/reference/http/admin-projectsprojectId-users-GET>`_, to find details about companies, call `GET companies <en/docs/acc/v1/reference/http/projects-:project_id-companies-GET/>`_. Note that we do not currently support finding details about roles for a project.
    autodesk_id: Optional[str] = None
    # When the record was created.
    created_at: Optional[datetime.datetime] = None
    # Autodesk ID of the user who has created the project.
    created_by: Optional[str] = None
    # The unique identifier (UUID) of the user-role mapping record.
    id: Optional[UUID] = None
    # Not relevant
    oxygen_id: Optional[str] = None
    # The role of the user in Submittals. Possible values: ``1`` (manager).
    submittals_role: Optional[MappingsGetResponse_results_submittalsRole] = None
    # When the record was last updated.
    updated_at: Optional[datetime.datetime] = None
    # Autodesk ID of the last user who updated the record.
    updated_by: Optional[str] = None
    # The ID for the type of user in the record. Possible values: ``1`` (user), ``2`` (company), ``3`` (role).
    user_type: Optional[MappingsGetResponse_results_userType] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> MappingsGetResponse_results:
        """
        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: MappingsGetResponse_results
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return MappingsGetResponse_results()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .mappings_get_response_results_submittals_role import MappingsGetResponse_results_submittalsRole
        from .mappings_get_response_results_user_type import MappingsGetResponse_results_userType

        from .mappings_get_response_results_submittals_role import MappingsGetResponse_results_submittalsRole
        from .mappings_get_response_results_user_type import MappingsGetResponse_results_userType

        fields: dict[str, Callable[[Any], None]] = {
            "autodeskId": lambda n : setattr(self, 'autodesk_id', n.get_str_value()),
            "createdAt": lambda n : setattr(self, 'created_at', n.get_datetime_value()),
            "createdBy": lambda n : setattr(self, 'created_by', n.get_str_value()),
            "id": lambda n : setattr(self, 'id', n.get_uuid_value()),
            "oxygenId": lambda n : setattr(self, 'oxygen_id', n.get_str_value()),
            "submittalsRole": lambda n : setattr(self, 'submittals_role', n.get_enum_value(MappingsGetResponse_results_submittalsRole)),
            "updatedAt": lambda n : setattr(self, 'updated_at', n.get_datetime_value()),
            "updatedBy": lambda n : setattr(self, 'updated_by', n.get_str_value()),
            "userType": lambda n : setattr(self, 'user_type', n.get_enum_value(MappingsGetResponse_results_userType)),
        }
        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("autodeskId", self.autodesk_id)
        writer.write_datetime_value("createdAt", self.created_at)
        writer.write_str_value("createdBy", self.created_by)
        writer.write_uuid_value("id", self.id)
        writer.write_str_value("oxygenId", self.oxygen_id)
        writer.write_enum_value("submittalsRole", self.submittals_role)
        writer.write_datetime_value("updatedAt", self.updated_at)
        writer.write_str_value("updatedBy", self.updated_by)
        writer.write_enum_value("userType", self.user_type)
    

