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

@dataclass
class TemplatesGetResponse_results_steps(Parsable):
    # Specifies a dynamic due date. When the step starts, the due date is calculated based on this field.
    days_to_respond: Optional[float] = None
    # The internal, globally unique identifier (UUID) for the step. Each step in the workflow has a unique ID.
    id: Optional[UUID] = None
    # The number representing the order of the steps, where ``1`` is the first step.
    step_number: Optional[float] = None
    # A list of tasks associated with this template. Each task has its own unique identifier (UUID).
    tasks: Optional[list[TemplatesGetResponse_results_steps_tasks]] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> TemplatesGetResponse_results_steps:
        """
        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
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return TemplatesGetResponse_results_steps()
    
    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 import TemplatesGetResponse_results_steps_tasks

        from .templates_get_response_results_steps_tasks import TemplatesGetResponse_results_steps_tasks

        fields: dict[str, Callable[[Any], None]] = {
            "daysToRespond": lambda n : setattr(self, 'days_to_respond', n.get_float_value()),
            "id": lambda n : setattr(self, 'id', n.get_uuid_value()),
            "stepNumber": lambda n : setattr(self, 'step_number', n.get_float_value()),
            "tasks": lambda n : setattr(self, 'tasks', n.get_collection_of_object_values(TemplatesGetResponse_results_steps_tasks)),
        }
        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_float_value("daysToRespond", self.days_to_respond)
        writer.write_uuid_value("id", self.id)
        writer.write_float_value("stepNumber", self.step_number)
        writer.write_collection_of_object_values("tasks", self.tasks)
    

