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 .status_step_sets_post_response_values import StatusStepSetsPostResponse_values

@dataclass
class StatusStepSetsPostResponse(Parsable):
    # The time when the component was created (ISO8601 Date time format in UTC).
    created_at: Optional[str] = None
    # The actor that created the component. This is an Autodesk / Oxygen ID.
    created_by: Optional[str] = None
    # The time when the component was deleted at (ISO8601 Date time format in UTC).
    deleted_at: Optional[str] = None
    # The actor that deleted the component. This is an Autodesk / Oxygen ID.
    deleted_by: Optional[str] = None
    # A description of the status set.Max length: 500
    description: Optional[str] = None
    # The ID of the component.
    id: Optional[str] = None
    # A flag indicating whether the component is active or inactive (``isActive`` is ``true`` if-and-only-if ``deletedAt`` is empty).
    is_active: Optional[bool] = None
    # Specifies if this is the status set that is assigned to categories by default - that is, this is thestatus set that will be assigned to categories if no other status set has been assigned, eitherexplicitly or through inheritance. If ``true``, it's the default status set. If ``false``, it's not.
    is_default: Optional[bool] = None
    # The display name for the status set. This name appears in the Assets UI when viewing status sets.Max length: 100
    name: Optional[str] = None
    # The Autodesk Construction Cloud project ID. Must be a UUID or a project ID of the form ``b.{UUID}``.
    project_id: Optional[UUID] = None
    # The time when the component was last updated (ISO8601 Date time format in UTC).
    updated_at: Optional[str] = None
    # The actor that last updated the component. This is an Autodesk / Oxygen ID.
    updated_by: Optional[str] = None
    # An array of statuses that belong to this status set.
    values: Optional[list[StatusStepSetsPostResponse_values]] = None
    # A global sequence number that is incremented any time a component of this type is created, updated, or deleted. If you cache components, you can use the version value to compare the cached component to the same component online to see if the component has been updated. If the online component has a higher version value, it has been updated.
    version: Optional[int] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> StatusStepSetsPostResponse:
        """
        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: StatusStepSetsPostResponse
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return StatusStepSetsPostResponse()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .status_step_sets_post_response_values import StatusStepSetsPostResponse_values

        from .status_step_sets_post_response_values import StatusStepSetsPostResponse_values

        fields: dict[str, Callable[[Any], None]] = {
            "createdAt": lambda n : setattr(self, 'created_at', n.get_str_value()),
            "createdBy": lambda n : setattr(self, 'created_by', n.get_str_value()),
            "deletedAt": lambda n : setattr(self, 'deleted_at', n.get_str_value()),
            "deletedBy": lambda n : setattr(self, 'deleted_by', n.get_str_value()),
            "description": lambda n : setattr(self, 'description', n.get_str_value()),
            "id": lambda n : setattr(self, 'id', n.get_str_value()),
            "isActive": lambda n : setattr(self, 'is_active', n.get_bool_value()),
            "isDefault": lambda n : setattr(self, 'is_default', n.get_bool_value()),
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "projectId": lambda n : setattr(self, 'project_id', n.get_uuid_value()),
            "updatedAt": lambda n : setattr(self, 'updated_at', n.get_str_value()),
            "updatedBy": lambda n : setattr(self, 'updated_by', n.get_str_value()),
            "values": lambda n : setattr(self, 'values', n.get_collection_of_object_values(StatusStepSetsPostResponse_values)),
            "version": lambda n : setattr(self, 'version', n.get_int_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("createdAt", self.created_at)
        writer.write_str_value("createdBy", self.created_by)
        writer.write_str_value("deletedAt", self.deleted_at)
        writer.write_str_value("deletedBy", self.deleted_by)
        writer.write_str_value("description", self.description)
        writer.write_str_value("id", self.id)
        writer.write_bool_value("isActive", self.is_active)
        writer.write_bool_value("isDefault", self.is_default)
        writer.write_str_value("name", self.name)
        writer.write_uuid_value("projectId", self.project_id)
        writer.write_str_value("updatedAt", self.updated_at)
        writer.write_str_value("updatedBy", self.updated_by)
        writer.write_collection_of_object_values("values", self.values)
        writer.write_int_value("version", self.version)
    

