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 .templates_get_response_results_steps import TemplatesGetResponse_results_steps
    from .templates_get_response_results_watchers import TemplatesGetResponse_results_watchers

@dataclass
class TemplatesGetResponse_results(Parsable):
    # The date and time when the template was originally 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 template.
    created_by: Optional[str] = None
    # The internal, globally unique identifier (UUID) for the template. Each template in the workflow has a unique ID.
    id: Optional[UUID] = None
    # The name of the template.
    name: Optional[str] = None
    # The list of steps included in the template. Each step defines specific actions and associated tasks.
    steps: Optional[list[TemplatesGetResponse_results_steps]] = None
    # The date and time when the template 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 last updated the template.
    updated_by: Optional[str] = None
    # A list of project watchers, who can be individual users, roles, or companies.
    watchers: Optional[list[TemplatesGetResponse_results_watchers]] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> TemplatesGetResponse_results:
        """
        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
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return TemplatesGetResponse_results()
    
    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 import TemplatesGetResponse_results_steps
        from .templates_get_response_results_watchers import TemplatesGetResponse_results_watchers

        from .templates_get_response_results_steps import TemplatesGetResponse_results_steps
        from .templates_get_response_results_watchers import TemplatesGetResponse_results_watchers

        fields: dict[str, Callable[[Any], None]] = {
            "createdAt": lambda n : setattr(self, 'created_at', n.get_datetime_value()),
            "createdBy": lambda n : setattr(self, 'created_by', n.get_str_value()),
            "id": lambda n : setattr(self, 'id', n.get_uuid_value()),
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "steps": lambda n : setattr(self, 'steps', n.get_collection_of_object_values(TemplatesGetResponse_results_steps)),
            "updatedAt": lambda n : setattr(self, 'updated_at', n.get_datetime_value()),
            "updatedBy": lambda n : setattr(self, 'updated_by', n.get_str_value()),
            "watchers": lambda n : setattr(self, 'watchers', n.get_collection_of_object_values(TemplatesGetResponse_results_watchers)),
        }
        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("createdAt", self.created_at)
        writer.write_str_value("createdBy", self.created_by)
        writer.write_uuid_value("id", self.id)
        writer.write_str_value("name", self.name)
        writer.write_collection_of_object_values("steps", self.steps)
        writer.write_datetime_value("updatedAt", self.updated_at)
        writer.write_str_value("updatedBy", self.updated_by)
        writer.write_collection_of_object_values("watchers", self.watchers)
    

