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 .packages_get_response_results_permitted_actions import PackagesGetResponse_results_permittedActions

@dataclass
class PackagesGetResponse_results(Parsable):
    # The description of the package.
    description: Optional[str] = None
    # The internal, globally unique identifier (UUID) for the package.
    id: Optional[UUID] = None
    # The unique ID assigned to the package within the UI.
    identifier: Optional[int] = None
    # The list of actions the user is allowed to perform on the submittal item.
    permitted_actions: Optional[list[PackagesGetResponse_results_permittedActions]] = None
    # The internal, globally unique identifier (UUID) of the spec associated with the package.
    spec_id: Optional[UUID] = None
    # The unique ID of the spec assigned to the package in the UI, specific to each project.
    spec_identifier: Optional[str] = None
    # The title of the package.
    title: Optional[str] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> PackagesGetResponse_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: PackagesGetResponse_results
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return PackagesGetResponse_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 .packages_get_response_results_permitted_actions import PackagesGetResponse_results_permittedActions

        from .packages_get_response_results_permitted_actions import PackagesGetResponse_results_permittedActions

        fields: dict[str, Callable[[Any], None]] = {
            "description": lambda n : setattr(self, 'description', n.get_str_value()),
            "id": lambda n : setattr(self, 'id', n.get_uuid_value()),
            "identifier": lambda n : setattr(self, 'identifier', n.get_int_value()),
            "permittedActions": lambda n : setattr(self, 'permitted_actions', n.get_collection_of_object_values(PackagesGetResponse_results_permittedActions)),
            "specId": lambda n : setattr(self, 'spec_id', n.get_uuid_value()),
            "specIdentifier": lambda n : setattr(self, 'spec_identifier', n.get_str_value()),
            "title": lambda n : setattr(self, 'title', 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("description", self.description)
        writer.write_uuid_value("id", self.id)
        writer.write_int_value("identifier", self.identifier)
        writer.write_collection_of_object_values("permittedActions", self.permitted_actions)
        writer.write_uuid_value("specId", self.spec_id)
        writer.write_str_value("specIdentifier", self.spec_identifier)
        writer.write_str_value("title", self.title)
    

