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 .attributes_post_request_body_possible_values import AttributesPostRequestBody_possibleValues
    from .attributes_post_request_body_status import AttributesPostRequestBody_status
    from .attributes_post_request_body_type import AttributesPostRequestBody_type

@dataclass
class AttributesPostRequestBody(Parsable):
    # The description of the attribute as shown in the UI.Max length: 1000
    description: Optional[str] = None
    # ``true``: users can select more than one value for this attribute.``false``: (default) users can select only one value.
    multiple_choice: Optional[bool] = None
    # The name of the custom attribute as displayed in the UI.Max length: 50
    name: Optional[str] = None
    # A list of possible values for the attribute.
    possible_values: Optional[list[AttributesPostRequestBody_possibleValues]] = None
    # The display status of the attribute in the UI. Possible values: ``active``, ``inactive``, ``hidden``.
    status: Optional[AttributesPostRequestBody_status] = None
    # The type of the attribute.Possible values: ``text``, ``numeric``
    type: Optional[AttributesPostRequestBody_type] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> AttributesPostRequestBody:
        """
        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: AttributesPostRequestBody
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return AttributesPostRequestBody()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .attributes_post_request_body_possible_values import AttributesPostRequestBody_possibleValues
        from .attributes_post_request_body_status import AttributesPostRequestBody_status
        from .attributes_post_request_body_type import AttributesPostRequestBody_type

        from .attributes_post_request_body_possible_values import AttributesPostRequestBody_possibleValues
        from .attributes_post_request_body_status import AttributesPostRequestBody_status
        from .attributes_post_request_body_type import AttributesPostRequestBody_type

        fields: dict[str, Callable[[Any], None]] = {
            "description": lambda n : setattr(self, 'description', n.get_str_value()),
            "multipleChoice": lambda n : setattr(self, 'multiple_choice', n.get_bool_value()),
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "possibleValues": lambda n : setattr(self, 'possible_values', n.get_collection_of_object_values(AttributesPostRequestBody_possibleValues)),
            "status": lambda n : setattr(self, 'status', n.get_enum_value(AttributesPostRequestBody_status)),
            "type": lambda n : setattr(self, 'type', n.get_enum_value(AttributesPostRequestBody_type)),
        }
        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("description", self.description)
        writer.write_bool_value("multipleChoice", self.multiple_choice)
        writer.write_str_value("name", self.name)
        writer.write_collection_of_object_values("possibleValues", self.possible_values)
        writer.write_enum_value("status", self.status)
        writer.write_enum_value("type", self.type)
    

