from __future__ import annotations
import datetime
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_version_type import PackagesGetResponse_results_versionType

@dataclass
class PackagesGetResponse_results(Parsable):
    # The time the package was created.
    created_at: Optional[datetime.datetime] = None
    # The Autodesk ID of the user who created the package. For details about the user, call `GET users </en/docs/acc/v1/reference/http/admin-projectsprojectId-users-GET/>`_.
    created_by: Optional[str] = None
    # The description of the package.Max length: 2048
    description: Optional[str] = None
    # The display ID of the package.
    display_id: Optional[int] = None
    # The unique identifier (UUID) of the package.
    id: Optional[UUID] = None
    # ``true``: The package is locked. Its contents cannot be modified until it is unlocked.``false``: The package is not locked. Files and resources can still be added, removed, or updated.
    locked: Optional[bool] = None
    # The time the package was locked.
    locked_at: Optional[datetime.datetime] = None
    # The Autodesk ID of the user who locked the package. For details about the user, call `GET users </en/docs/acc/v1/reference/http/admin-projectsprojectId-users-GET/>`_.
    locked_by: Optional[str] = None
    # The name of the package.Max length: 255
    name: Optional[str] = None
    # The number of resources in the package.
    resource_count: Optional[int] = None
    # The time the package was last updated.
    updated_at: Optional[datetime.datetime] = None
    # The Autodesk ID of the user who last updated the package. For details about the user, call `GET users </en/docs/acc/v1/reference/http/admin-projectsprojectId-users-GET/>`_.
    updated_by: Optional[str] = None
    # The version type of the package.Possible values:- ``FIXED`` – The files in the package remain fixed at the selected versions.- ``CURRENT`` – The files in the package automatically update to the latest current versions.- ``CHANGING`` – The package is temporarily changing from one version type to another. This state usually lasts only a few seconds and cannot be used as a filter.For more details, see the `Change Package Version Type <https://help.autodesk.com/view/BUILD/ENU/?guid=View_Manage_Packages#change-package-version-type>`_ documentation.
    version_type: Optional[PackagesGetResponse_results_versionType] = 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_version_type import PackagesGetResponse_results_versionType

        from .packages_get_response_results_version_type import PackagesGetResponse_results_versionType

        fields: dict[str, Callable[[Any], None]] = {
            "createdAt": lambda n : setattr(self, 'created_at', n.get_datetime_value()),
            "createdBy": lambda n : setattr(self, 'created_by', n.get_str_value()),
            "description": lambda n : setattr(self, 'description', n.get_str_value()),
            "displayId": lambda n : setattr(self, 'display_id', n.get_int_value()),
            "id": lambda n : setattr(self, 'id', n.get_uuid_value()),
            "locked": lambda n : setattr(self, 'locked', n.get_bool_value()),
            "lockedAt": lambda n : setattr(self, 'locked_at', n.get_datetime_value()),
            "lockedBy": lambda n : setattr(self, 'locked_by', n.get_str_value()),
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "resourceCount": lambda n : setattr(self, 'resource_count', n.get_int_value()),
            "updatedAt": lambda n : setattr(self, 'updated_at', n.get_datetime_value()),
            "updatedBy": lambda n : setattr(self, 'updated_by', n.get_str_value()),
            "versionType": lambda n : setattr(self, 'version_type', n.get_object_value(PackagesGetResponse_results_versionType)),
        }
        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_datetime_value("createdAt", self.created_at)
        writer.write_str_value("createdBy", self.created_by)
        writer.write_str_value("description", self.description)
        writer.write_int_value("displayId", self.display_id)
        writer.write_uuid_value("id", self.id)
        writer.write_bool_value("locked", self.locked)
        writer.write_datetime_value("lockedAt", self.locked_at)
        writer.write_str_value("lockedBy", self.locked_by)
        writer.write_str_value("name", self.name)
        writer.write_int_value("resourceCount", self.resource_count)
        writer.write_datetime_value("updatedAt", self.updated_at)
        writer.write_str_value("updatedBy", self.updated_by)
        writer.write_object_value("versionType", self.version_type)
    

