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

@dataclass
class CategoriesBatchGetPostResponse_results(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 category.
    description: Optional[str] = None
    # The ID of the category. This is a numeric string for ``v1`` category APIs.
    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
    # Whether or not this category is a leaf category of the category tree. If ``true``, it's a leaf; if ``false``,it's not.Note that this is a derived field and should not be persisted as this field may be updated withoutupdating the category itself.
    is_leaf: Optional[bool] = None
    # Whether or not this category is the root category of the category tree. If ``true``, it's the root; if``false``, it's not. There will only ever be one (immutable) root category for a project, which is createdautomatically when the project is created.
    is_root: Optional[bool] = None
    # The name of the category. Must be unique among children of the same parent category. This name is displayedfor the category in the Assets user interface where a user chooses categories.
    name: Optional[str] = None
    # The ID of the category's parent category.
    parent_id: Optional[str] = None
    # An array of category IDs of this category's child categories.Note that this is a derived field and should not be persisted as this field may be updated withoutupdating the category itself. As such, it is highly recommended to use the ``parentId`` field toconstruct the tree locally instead of ``subcategoryIds``.
    subcategory_ids: Optional[list[str]] = None
    # The globally-unique ID of a ``Category`` from the ``v3`` (upcoming) Category APIs. This is providedfor interoperability with other APIs that use the globally-unique category ID. Only included if the``includeUid=true`` query param is included.
    uid: Optional[str] = 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
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> CategoriesBatchGetPostResponse_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: CategoriesBatchGetPostResponse_results
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return CategoriesBatchGetPostResponse_results()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        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()),
            "isLeaf": lambda n : setattr(self, 'is_leaf', n.get_bool_value()),
            "isRoot": lambda n : setattr(self, 'is_root', n.get_bool_value()),
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "parentId": lambda n : setattr(self, 'parent_id', n.get_str_value()),
            "subcategoryIds": lambda n : setattr(self, 'subcategory_ids', n.get_collection_of_primitive_values(str)),
            "uid": lambda n : setattr(self, 'uid', n.get_str_value()),
            "updatedAt": lambda n : setattr(self, 'updated_at', n.get_str_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_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("isLeaf", self.is_leaf)
        writer.write_bool_value("isRoot", self.is_root)
        writer.write_str_value("name", self.name)
        writer.write_str_value("parentId", self.parent_id)
        writer.write_collection_of_primitive_values("subcategoryIds", self.subcategory_ids)
        writer.write_str_value("uid", self.uid)
        writer.write_str_value("updatedAt", self.updated_at)
        writer.write_str_value("updatedBy", self.updated_by)
    

