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 .templates_get_response_results_watchers_user_type import TemplatesGetResponse_results_watchers_userType

@dataclass
class TemplatesGetResponse_results_watchers(Parsable):
    # The Autodesk ID of the watcher. The watcher can be a 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.
    id: Optional[str] = None
    # The type of watcher assigned to the submittal item.Possible values:- ``1`` (user)- ``2`` (company)- ``3`` (role)
    user_type: Optional[TemplatesGetResponse_results_watchers_userType] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> TemplatesGetResponse_results_watchers:
        """
        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: TemplatesGetResponse_results_watchers
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return TemplatesGetResponse_results_watchers()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .templates_get_response_results_watchers_user_type import TemplatesGetResponse_results_watchers_userType

        from .templates_get_response_results_watchers_user_type import TemplatesGetResponse_results_watchers_userType

        fields: dict[str, Callable[[Any], None]] = {
            "id": lambda n : setattr(self, 'id', n.get_str_value()),
            "userType": lambda n : setattr(self, 'user_type', n.get_object_value(TemplatesGetResponse_results_watchers_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("id", self.id)
        writer.write_object_value("userType", self.user_type)
    

