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 .with_step_get_response_permitted_actions import WithStepGetResponse_permittedActions
    from .with_step_get_response_status import WithStepGetResponse_status
    from .with_step_get_response_tasks import WithStepGetResponse_tasks

@dataclass
class WithStepGetResponse(Parsable):
    # The date and time when the step was completed, formatted as YYYY-MM-DDTHH:mm:ss.SSSSSSZ (ISO 8601) in UTC. For example, ``2025-01-20T12:00:00.198466Z``.
    completed_at: Optional[datetime.datetime] = None
    # The date and time when the step was created, formatted as YYYY-MM-DDTHH:mm:ss.SSSSSSZ (ISO 8601) in UTC. For example, ``2025-01-20T12:00:00.198466Z``.
    created_at: Optional[datetime.datetime] = None
    # The Autodesk ID of the user that created the step.
    created_by: Optional[str] = None
    # 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 due date of the step in the format ``YYYY-MM-DD`` (ISO 8601) in UTC. For example, ``2018-02-15``.
    due_date: Optional[str] = None
    # The internal, globally unique identifier (UUID) for the step.
    id: Optional[UUID] = None
    # The ID of the item associated with the step.
    item_id: Optional[UUID] = None
    # A list of actions that the user is allowed to perform on the step.
    permitted_actions: Optional[list[WithStepGetResponse_permittedActions]] = None
    # The date and time when the step transitioned to ``In Progress`` in the backend. This corresponds to the step being marked as ``Started`` in the UI, formatted as YYYY-MM-DDTHH:mm:ss.SSSSSSZ (ISO 8601) in UTC. For example, ``2025-01-20T12:00:00.198466Z``.
    started_at: Optional[datetime.datetime] = None
    # The current status of the step. Possible values: ``not-started``, ``in-progress``, ``completed``.
    status: Optional[WithStepGetResponse_status] = None
    # The number representing the order of the steps, where ``1`` is the first step.
    step_number: Optional[float] = None
    # The list of tasks associated with the step.
    tasks: Optional[list[WithStepGetResponse_tasks]] = None
    # The date and time when the step was last updated, formatted as YYYY-MM-DDTHH:mm:ss.SSSSSSZ (ISO 8601) in UTC. For example, ``2025-01-20T12:00:00.198466Z``.
    updated_at: Optional[datetime.datetime] = None
    # The Autodesk ID of the user that updated the step.
    updated_by: Optional[str] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WithStepGetResponse:
        """
        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: WithStepGetResponse
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WithStepGetResponse()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .with_step_get_response_permitted_actions import WithStepGetResponse_permittedActions
        from .with_step_get_response_status import WithStepGetResponse_status
        from .with_step_get_response_tasks import WithStepGetResponse_tasks

        from .with_step_get_response_permitted_actions import WithStepGetResponse_permittedActions
        from .with_step_get_response_status import WithStepGetResponse_status
        from .with_step_get_response_tasks import WithStepGetResponse_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()),
            "createdBy": lambda n : setattr(self, 'created_by', n.get_str_value()),
            "daysToRespond": lambda n : setattr(self, 'days_to_respond', n.get_float_value()),
            "dueDate": lambda n : setattr(self, 'due_date', n.get_str_value()),
            "id": lambda n : setattr(self, 'id', n.get_uuid_value()),
            "itemId": lambda n : setattr(self, 'item_id', n.get_uuid_value()),
            "permittedActions": lambda n : setattr(self, 'permitted_actions', n.get_collection_of_object_values(WithStepGetResponse_permittedActions)),
            "startedAt": lambda n : setattr(self, 'started_at', n.get_datetime_value()),
            "status": lambda n : setattr(self, 'status', n.get_enum_value(WithStepGetResponse_status)),
            "stepNumber": lambda n : setattr(self, 'step_number', n.get_float_value()),
            "tasks": lambda n : setattr(self, 'tasks', n.get_collection_of_object_values(WithStepGetResponse_tasks)),
            "updatedAt": lambda n : setattr(self, 'updated_at', n.get_datetime_value()),
            "updatedBy": lambda n : setattr(self, 'updated_by', n.get_str_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_str_value("createdBy", self.created_by)
        writer.write_float_value("daysToRespond", self.days_to_respond)
        writer.write_str_value("dueDate", self.due_date)
        writer.write_uuid_value("id", self.id)
        writer.write_uuid_value("itemId", self.item_id)
        writer.write_collection_of_object_values("permittedActions", self.permitted_actions)
        writer.write_datetime_value("startedAt", self.started_at)
        writer.write_enum_value("status", self.status)
        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)
        writer.write_str_value("updatedBy", self.updated_by)
    

