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 .with_attribute_patch_request_body_possible_values_updated_attributes import WithAttributePatchRequestBody_possibleValues_updatedAttributes

@dataclass
class WithAttributePatchRequestBody_possibleValues(Parsable):
    # Deletes possible values from the attribute. Each item is the ID of a possible value to delete.
    deleted_attributes: Optional[list[str]] = None
    # Adds new possible values to the attribute.Each item is the name of a new possible value as shown in the UI.
    new_attributes: Optional[list[str]] = None
    # Updates the names of existing possible values.
    updated_attributes: Optional[list[WithAttributePatchRequestBody_possibleValues_updatedAttributes]] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WithAttributePatchRequestBody_possibleValues:
        """
        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: WithAttributePatchRequestBody_possibleValues
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WithAttributePatchRequestBody_possibleValues()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .with_attribute_patch_request_body_possible_values_updated_attributes import WithAttributePatchRequestBody_possibleValues_updatedAttributes

        from .with_attribute_patch_request_body_possible_values_updated_attributes import WithAttributePatchRequestBody_possibleValues_updatedAttributes

        fields: dict[str, Callable[[Any], None]] = {
            "deletedAttributes": lambda n : setattr(self, 'deleted_attributes', n.get_collection_of_primitive_values(str)),
            "newAttributes": lambda n : setattr(self, 'new_attributes', n.get_collection_of_primitive_values(str)),
            "updatedAttributes": lambda n : setattr(self, 'updated_attributes', n.get_collection_of_object_values(WithAttributePatchRequestBody_possibleValues_updatedAttributes)),
        }
        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_collection_of_primitive_values("deletedAttributes", self.deleted_attributes)
        writer.write_collection_of_primitive_values("newAttributes", self.new_attributes)
        writer.write_collection_of_object_values("updatedAttributes", self.updated_attributes)
    

