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
from uuid import UUID

if TYPE_CHECKING:
    from .nodes_get_response_results_type import NodesGetResponse_results_type

@dataclass
class NodesGetResponse_results(Parsable):
    # The barcode that represents this LBS node. This value must be unique per project.Max length: 255
    barcode: Optional[str] = None
    # Not relevant
    description: Optional[str] = None
    # This field is reserved for future use.
    document_count: Optional[int] = None
    # The unique identifier of the new LBS node.
    id: Optional[UUID] = None
    # The name of this LBS node.Max length: 255
    name: Optional[str] = None
    # This node's position relative to its sibling nodes. Nodes with the same parent have a defined sequence order. A node with a lower ``order`` value will be positioned before a node with a higher ``order`` value.This is zero-based; for example, a node with an ``order`` value of ``3`` is the fourth node among its sibling nodes.If an existing sibling node has the same or higher ``order`` value, that value will be incremented to make room for the new node.
    order: Optional[int] = None
    # The identifier of the parent node of this LBS node.
    parent_id: Optional[UUID] = None
    # The path from the root node to the current node. Note that this is only included if you use the ``filter[id]`` parameter.
    path: Optional[list[str]] = None
    # The type of this LBS node. Note that only ``Area`` is a currently supported request value.Possible values: ``Area``, ``Level``, ``Root``
    type: Optional[NodesGetResponse_results_type] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> NodesGetResponse_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: NodesGetResponse_results
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return NodesGetResponse_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 .nodes_get_response_results_type import NodesGetResponse_results_type

        from .nodes_get_response_results_type import NodesGetResponse_results_type

        fields: dict[str, Callable[[Any], None]] = {
            "barcode": lambda n : setattr(self, 'barcode', n.get_str_value()),
            "description": lambda n : setattr(self, 'description', n.get_str_value()),
            "documentCount": lambda n : setattr(self, 'document_count', n.get_int_value()),
            "id": lambda n : setattr(self, 'id', n.get_uuid_value()),
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "order": lambda n : setattr(self, 'order', n.get_int_value()),
            "parentId": lambda n : setattr(self, 'parent_id', n.get_uuid_value()),
            "path": lambda n : setattr(self, 'path', n.get_collection_of_primitive_values(str)),
            "type": lambda n : setattr(self, 'type', n.get_enum_value(NodesGetResponse_results_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("barcode", self.barcode)
        writer.write_str_value("description", self.description)
        writer.write_int_value("documentCount", self.document_count)
        writer.write_uuid_value("id", self.id)
        writer.write_str_value("name", self.name)
        writer.write_int_value("order", self.order)
        writer.write_uuid_value("parentId", self.parent_id)
        writer.write_collection_of_primitive_values("path", self.path)
        writer.write_enum_value("type", self.type)
    

