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

@dataclass
class ItemsValidateCustomIdentifierPostRequestBody(Parsable):
    # The ``customIdentifier`` is used to ensure that the chosen identifier adheres to format rules and is unique within the project. Submittal managers can assign custom numbers manually or automatically.When validating a custom identifier, consider the following rules:- Ensure the identifier is unique within the project.- For global sequences, ensure it is unique within the entire project.- For spec sequences, ensure it is unique within the specific spec section.- Spec sequence is in the format ``<spec_identifier>-<sequential_number>``. You only need to specify the sequential number. The full number - ``<spec_identifier>-<sequential_number>`` - appears in the response payload in the ``customIdentifierHumanReadable`` attribute.Regardless of whether the project uses a global or spec sequence, you should always provide only the sequential number portion without the spec ID when sending the ``customIdentifier``.For more information on custom numbering, see the `Help documentation <https://help.autodesk.com/view/BUILD/ENU/?guid=Submittal_Custom_Numbering>`_.
    custom_identifier: Optional[str] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> ItemsValidateCustomIdentifierPostRequestBody:
        """
        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: ItemsValidateCustomIdentifierPostRequestBody
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return ItemsValidateCustomIdentifierPostRequestBody()
    
    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]] = {
            "customIdentifier": lambda n : setattr(self, 'custom_identifier', 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_str_value("customIdentifier", self.custom_identifier)
    

