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 .issue_attribute_definitions_get_response_results_data_type import IssueAttributeDefinitionsGetResponse_results_dataType
    from .issue_attribute_definitions_get_response_results_metadata import IssueAttributeDefinitionsGetResponse_results_metadata

@dataclass
class IssueAttributeDefinitionsGetResponse_results(Parsable):
    # Not relevant
    container_id: Optional[UUID] = None
    # The date and time the custom attribute was created, in the following format: YYYY-MM-DDThh:mm:ss.sz.
    created_at: Optional[datetime.datetime] = None
    # The Autodesk ID of the user who created the custom attribute.
    created_by: Optional[str] = None
    # The type of custom attribute. Possible values: ``list``, ``text``, ``paragraph``, ``numeric``.
    data_type: Optional[IssueAttributeDefinitionsGetResponse_results_dataType] = None
    # The date and time the custom attribute was deleted, in the following format: YYYY-MM-DDThh:mm:ss.sz.
    deleted_at: Optional[datetime.datetime] = None
    # The Autodesk ID of the user who deleted the custom attribute.
    deleted_by: Optional[str] = None
    # The description of the custom attribute.Max length: 500
    description: Optional[str] = None
    # The ID of the custom attribute.
    id: Optional[UUID] = None
    # The metadata object; only relevant for ``list`` custom attributes.
    metadata: Optional[IssueAttributeDefinitionsGetResponse_results_metadata] = None
    # Not relevant
    permitted_actions: Optional[list[str]] = None
    # Not relevant
    permitted_attributes: Optional[list[str]] = None
    # The title of the custom attribute.Max length: 100
    title: Optional[str] = None
    # The last date and time the custom attribute was updated, in the following format: YYYY-MM-DDThh:mm:ss.sz.
    updated_at: Optional[datetime.datetime] = None
    # The Autodesk ID of the user who last updated the custom attribute.
    updated_by: Optional[str] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> IssueAttributeDefinitionsGetResponse_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: IssueAttributeDefinitionsGetResponse_results
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return IssueAttributeDefinitionsGetResponse_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 .issue_attribute_definitions_get_response_results_data_type import IssueAttributeDefinitionsGetResponse_results_dataType
        from .issue_attribute_definitions_get_response_results_metadata import IssueAttributeDefinitionsGetResponse_results_metadata

        from .issue_attribute_definitions_get_response_results_data_type import IssueAttributeDefinitionsGetResponse_results_dataType
        from .issue_attribute_definitions_get_response_results_metadata import IssueAttributeDefinitionsGetResponse_results_metadata

        fields: dict[str, Callable[[Any], None]] = {
            "containerId": lambda n : setattr(self, 'container_id', n.get_uuid_value()),
            "createdAt": lambda n : setattr(self, 'created_at', n.get_datetime_value()),
            "createdBy": lambda n : setattr(self, 'created_by', n.get_str_value()),
            "dataType": lambda n : setattr(self, 'data_type', n.get_enum_value(IssueAttributeDefinitionsGetResponse_results_dataType)),
            "deletedAt": lambda n : setattr(self, 'deleted_at', n.get_datetime_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_uuid_value()),
            "metadata": lambda n : setattr(self, 'metadata', n.get_object_value(IssueAttributeDefinitionsGetResponse_results_metadata)),
            "permittedActions": lambda n : setattr(self, 'permitted_actions', n.get_collection_of_primitive_values(str)),
            "permittedAttributes": lambda n : setattr(self, 'permitted_attributes', n.get_collection_of_primitive_values(str)),
            "title": lambda n : setattr(self, 'title', n.get_str_value()),
            "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_uuid_value("containerId", self.container_id)
        writer.write_datetime_value("createdAt", self.created_at)
        writer.write_str_value("createdBy", self.created_by)
        writer.write_enum_value("dataType", self.data_type)
        writer.write_datetime_value("deletedAt", self.deleted_at)
        writer.write_str_value("deletedBy", self.deleted_by)
        writer.write_str_value("description", self.description)
        writer.write_uuid_value("id", self.id)
        writer.write_object_value("metadata", self.metadata)
        writer.write_collection_of_primitive_values("permittedActions", self.permitted_actions)
        writer.write_collection_of_primitive_values("permittedAttributes", self.permitted_attributes)
        writer.write_str_value("title", self.title)
        writer.write_datetime_value("updatedAt", self.updated_at)
        writer.write_str_value("updatedBy", self.updated_by)
    

