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

if TYPE_CHECKING:
    from .assets_get_response_results_custom_attributes_asterisk import AssetsGetResponse_results_customAttributes_Asterisk

@dataclass
class AssetsGetResponse_results_customAttributes(Parsable):
    """
    An optional JSON dictionary specifying one or more custom attributes and values to be assigned to theasset. The custom attributes must belong to the set of custom attributes specified by the asset's category.The dictionary is a set of key:value pairs that each starts with the unique custom attribute name (not tobe confused with the custom attribute's display name) followed by the attribute value. The value must usethe data type defined by the attribute:For ``text``, the value is a string.For ``date``, the value is an ISO8601 date string with no time, for example, ``2020-04-10``.For ``select``, the value is a valid ID from the list of values defined for this custom attribute.For ``multi-select``, the value is an array of valid IDs from the list of values defined for this custom attribute.For ``boolean``, the value is a boolean.For ``numeric``, the value is a string that parses as a valid floating point number (not localized).
    """
    # The Asterisk property
    asterisk: Optional[AssetsGetResponse_results_customAttributes_Asterisk] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> AssetsGetResponse_results_customAttributes:
        """
        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: AssetsGetResponse_results_customAttributes
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return AssetsGetResponse_results_customAttributes()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .assets_get_response_results_custom_attributes_asterisk import AssetsGetResponse_results_customAttributes_Asterisk

        from .assets_get_response_results_custom_attributes_asterisk import AssetsGetResponse_results_customAttributes_Asterisk

        fields: dict[str, Callable[[Any], None]] = {
            "*": lambda n : setattr(self, 'asterisk', n.get_object_value(AssetsGetResponse_results_customAttributes_Asterisk)),
        }
        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_object_value("*", self.asterisk)
    

