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

@dataclass
class CustomAttributesGetResponse_results_values(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 ID of the custom attribute.
    custom_attribute_id: Optional[UUID] = 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
    # The display name of the value. Must be unique within the custom attribute (case-insensitive). Use togenerate the ``enumValues`` field for the custom attribute.
    display_name: 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
    # 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
    # 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) -> CustomAttributesGetResponse_results_values:
        """
        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: CustomAttributesGetResponse_results_values
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return CustomAttributesGetResponse_results_values()
    
    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()),
            "customAttributeId": lambda n : setattr(self, 'custom_attribute_id', n.get_uuid_value()),
            "deletedAt": lambda n : setattr(self, 'deleted_at', n.get_str_value()),
            "deletedBy": lambda n : setattr(self, 'deleted_by', n.get_str_value()),
            "displayName": lambda n : setattr(self, 'display_name', 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()),
            "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()),
            "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_uuid_value("customAttributeId", self.custom_attribute_id)
        writer.write_str_value("deletedAt", self.deleted_at)
        writer.write_str_value("deletedBy", self.deleted_by)
        writer.write_str_value("displayName", self.display_name)
        writer.write_str_value("id", self.id)
        writer.write_bool_value("isActive", self.is_active)
        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_int_value("version", self.version)
    

