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 .revisions_get_response_results_steps_tasks import RevisionsGetResponse_results_steps_tasks

@dataclass
class RevisionsGetResponse_results_steps(Parsable):
    # The date when the step was completed, formatted as YYYY-MM-DDTHH:mm:ss.SSSSSSZ (ISO 8601) in UTC. For example, ``2018-02-15T12:09:24.198466Z``. Note that this value will be ``null`` if not completed.
    completed_at: Optional[datetime.datetime] = None
    # The date when the step was created, formatted as YYYY-MM-DDTHH:mm:ss.SSSSSSZ (ISO 8601) in UTC. For example, ``2018-02-15T12:09:24.198466Z``.
    created_at: Optional[datetime.datetime] = None
    # A way to specify a dynamic due date instead of the the regular dueDate field. When the step will start the due date will be calculated and assigned according to this field.
    days_to_respond: Optional[float] = None
    # The due date for this step, in the following format: YYYY-MM-DD (ISO 8601) in UTC.  For example, ``2025-01-27T12:09:24.198466Z``.
    due_date: Optional[str] = None
    # The revision number of the submittal item when this step was recorded.
    revision: Optional[int] = None
    # The date and time when the step began, formatted as YYYY-MM-DDTHH:mm:ss.SSSSSSZ (ISO 8601) in UTC. For example, ``2018-02-15T12:09:24.198466Z``. Note that this value will be ``null`` if not started.
    started_at: Optional[datetime.datetime] = None
    # The unique identifier of the step within the submittal item's workflow for this revision.
    step_id: Optional[UUID] = None
    # The order of the step in the workflow at this revision. The first step is ``1``.
    step_number: Optional[float] = None
    # A list of tasks related to a specific step within the workflow.
    tasks: Optional[list[RevisionsGetResponse_results_steps_tasks]] = None
    # The date when the step was last updated, formatted as YYYY-MM-DDTHH:mm:ss.SSSSSSZ (ISO 8601) in UTC. For example, ``2018-02-15T12:09:24.198466Z``.
    updated_at: Optional[datetime.datetime] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> RevisionsGetResponse_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: RevisionsGetResponse_results_steps
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return RevisionsGetResponse_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 .revisions_get_response_results_steps_tasks import RevisionsGetResponse_results_steps_tasks

        from .revisions_get_response_results_steps_tasks import RevisionsGetResponse_results_steps_tasks

        fields: dict[str, Callable[[Any], None]] = {
            "completedAt": lambda n : setattr(self, 'completed_at', n.get_datetime_value()),
            "createdAt": lambda n : setattr(self, 'created_at', n.get_datetime_value()),
            "daysToRespond": lambda n : setattr(self, 'days_to_respond', n.get_float_value()),
            "dueDate": lambda n : setattr(self, 'due_date', n.get_str_value()),
            "revision": lambda n : setattr(self, 'revision', n.get_int_value()),
            "startedAt": lambda n : setattr(self, 'started_at', n.get_datetime_value()),
            "stepId": lambda n : setattr(self, 'step_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(RevisionsGetResponse_results_steps_tasks)),
            "updatedAt": lambda n : setattr(self, 'updated_at', n.get_datetime_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_datetime_value("completedAt", self.completed_at)
        writer.write_datetime_value("createdAt", self.created_at)
        writer.write_float_value("daysToRespond", self.days_to_respond)
        writer.write_str_value("dueDate", self.due_date)
        writer.write_int_value("revision", self.revision)
        writer.write_datetime_value("startedAt", self.started_at)
        writer.write_uuid_value("stepId", self.step_id)
        writer.write_float_value("stepNumber", self.step_number)
        writer.write_collection_of_object_values("tasks", self.tasks)
        writer.write_datetime_value("updatedAt", self.updated_at)
    

