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 .templates_get_response_results_steps_tasks_assigned_to_type import TemplatesGetResponse_results_steps_tasks_assignedToType

@dataclass
class TemplatesGetResponse_results_steps_tasks(Parsable):
    # The Autodesk ID or member group ID of the ``user``, ``company``, or ``role`` assigned to the task.
    assigned_to: Optional[str] = None
    # Specifies whether the task is assigned to a user, company, or role.Possible values: ``1`` (user), ``2`` (company), ``3`` (role).
    assigned_to_type: Optional[TemplatesGetResponse_results_steps_tasks_assignedToType] = None
    # The internal, globally unique identifier (UUID) for the task.
    id: Optional[UUID] = None
    # - ``true``: the task is required to complete the step.- ``false``: (default) the task is not required to complete the step.
    is_required: Optional[bool] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> TemplatesGetResponse_results_steps_tasks:
        """
        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_steps_tasks
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return TemplatesGetResponse_results_steps_tasks()
    
    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_steps_tasks_assigned_to_type import TemplatesGetResponse_results_steps_tasks_assignedToType

        from .templates_get_response_results_steps_tasks_assigned_to_type import TemplatesGetResponse_results_steps_tasks_assignedToType

        fields: dict[str, Callable[[Any], None]] = {
            "assignedTo": lambda n : setattr(self, 'assigned_to', n.get_str_value()),
            "assignedToType": lambda n : setattr(self, 'assigned_to_type', n.get_enum_value(TemplatesGetResponse_results_steps_tasks_assignedToType)),
            "id": lambda n : setattr(self, 'id', n.get_uuid_value()),
            "isRequired": lambda n : setattr(self, 'is_required', n.get_bool_value()),
        }
        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("assignedTo", self.assigned_to)
        writer.write_enum_value("assignedToType", self.assigned_to_type)
        writer.write_uuid_value("id", self.id)
        writer.write_bool_value("isRequired", self.is_required)
    

