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 .resources_get_response_results_approval_status import ResourcesGetResponse_results_approvalStatus
    from .resources_get_response_results_custom_attributes import ResourcesGetResponse_results_customAttributes
    from .resources_get_response_results_entity_type import ResourcesGetResponse_results_entityType

@dataclass
class ResourcesGetResponse_results(Parsable):
    # The approval status of the file version.For more information, see `File Status <https://help.autodesk.com/view/DOCS/ENU/?guid=Reviews_Files>`_ documentation.
    approval_status: Optional[ResourcesGetResponse_results_approvalStatus] = None
    # The time and date the file version was created.
    created_at: Optional[str] = None
    # The Autodesk ID of the user who created the version. For details about the user, call `GET users </en/docs/acc/v1/reference/http/admin-projectsprojectId-users-GET/>`_.
    created_by: Optional[str] = None
    # The name of the user who created the file version.
    created_by_name: Optional[str] = None
    # A list of custom attributes assigned to the file version.For more information, see `Customize Documents with Attributes <https://help.autodesk.com/view/DOCS/ENU/?guid=File_attributes>`_.
    custom_attributes: Optional[list[ResourcesGetResponse_results_customAttributes]] = None
    # The description of the file version.
    description: Optional[str] = None
    # The type of file version. Possible values:- ``SEED_FILE`` – A document that was not split into sheets when uploaded to ACC Files.- ``DOCUMENT`` – A document that was split into sheets when uploaded to ACC Files.
    entity_type: Optional[ResourcesGetResponse_results_entityType] = None
    # The file type of the version.For more details, see the `Supported Files <https://help.autodesk.com/view/BUILD/ENU/?guid=Supported_Files_Docs>`_ documentation.
    file_type: Optional[str] = None
    # The unique identifier (UUID) of the file version.
    id: Optional[UUID] = None
    # Indicates whether the file version has been deleted.``true`` – The file version is deleted, either directly or because its parent folder was deleted.``false`` – The file version is not deleted.
    is_deleted: Optional[bool] = None
    # The file name in ACC Files.Max length: 255
    name: Optional[str] = None
    # The ID (URN) of the parent folder that contains the file version.
    parent_folder_urn: Optional[str] = None
    # The URN of the file version’s storage object.
    storage_urn: Optional[str] = None
    # The time and date when the file version was last modified.
    updated_at: Optional[str] = None
    # The Autodesk ID of the user who last modified the version. For details about the user, call `GET users </en/docs/acc/v1/reference/http/admin-projectsprojectId-users-GET/>`_.
    updated_by: Optional[str] = None
    # The name of the user who last modified the file version.
    updated_by_name: Optional[str] = None
    # The ID (URN) of the file version in ACC.
    urn: Optional[str] = None
    # The version number of the resource in ACC Files.This number increases when the file is completely replaced (for example, re-uploaded and overwritten), not when it is merely updated or saved.
    version: Optional[int] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> ResourcesGetResponse_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: ResourcesGetResponse_results
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return ResourcesGetResponse_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 .resources_get_response_results_approval_status import ResourcesGetResponse_results_approvalStatus
        from .resources_get_response_results_custom_attributes import ResourcesGetResponse_results_customAttributes
        from .resources_get_response_results_entity_type import ResourcesGetResponse_results_entityType

        from .resources_get_response_results_approval_status import ResourcesGetResponse_results_approvalStatus
        from .resources_get_response_results_custom_attributes import ResourcesGetResponse_results_customAttributes
        from .resources_get_response_results_entity_type import ResourcesGetResponse_results_entityType

        fields: dict[str, Callable[[Any], None]] = {
            "approvalStatus": lambda n : setattr(self, 'approval_status', n.get_object_value(ResourcesGetResponse_results_approvalStatus)),
            "createdAt": lambda n : setattr(self, 'created_at', n.get_str_value()),
            "createdBy": lambda n : setattr(self, 'created_by', n.get_str_value()),
            "createdByName": lambda n : setattr(self, 'created_by_name', n.get_str_value()),
            "customAttributes": lambda n : setattr(self, 'custom_attributes', n.get_collection_of_object_values(ResourcesGetResponse_results_customAttributes)),
            "description": lambda n : setattr(self, 'description', n.get_str_value()),
            "entityType": lambda n : setattr(self, 'entity_type', n.get_enum_value(ResourcesGetResponse_results_entityType)),
            "fileType": lambda n : setattr(self, 'file_type', n.get_str_value()),
            "id": lambda n : setattr(self, 'id', n.get_uuid_value()),
            "isDeleted": lambda n : setattr(self, 'is_deleted', n.get_bool_value()),
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "parentFolderUrn": lambda n : setattr(self, 'parent_folder_urn', n.get_str_value()),
            "storageUrn": lambda n : setattr(self, 'storage_urn', n.get_str_value()),
            "updatedAt": lambda n : setattr(self, 'updated_at', n.get_str_value()),
            "updatedBy": lambda n : setattr(self, 'updated_by', n.get_str_value()),
            "updatedByName": lambda n : setattr(self, 'updated_by_name', n.get_str_value()),
            "urn": lambda n : setattr(self, 'urn', n.get_str_value()),
            "version": lambda n : setattr(self, 'version', n.get_int_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_object_value("approvalStatus", self.approval_status)
        writer.write_str_value("createdAt", self.created_at)
        writer.write_str_value("createdBy", self.created_by)
        writer.write_str_value("createdByName", self.created_by_name)
        writer.write_collection_of_object_values("customAttributes", self.custom_attributes)
        writer.write_str_value("description", self.description)
        writer.write_enum_value("entityType", self.entity_type)
        writer.write_str_value("fileType", self.file_type)
        writer.write_uuid_value("id", self.id)
        writer.write_bool_value("isDeleted", self.is_deleted)
        writer.write_str_value("name", self.name)
        writer.write_str_value("parentFolderUrn", self.parent_folder_urn)
        writer.write_str_value("storageUrn", self.storage_urn)
        writer.write_str_value("updatedAt", self.updated_at)
        writer.write_str_value("updatedBy", self.updated_by)
        writer.write_str_value("updatedByName", self.updated_by_name)
        writer.write_str_value("urn", self.urn)
        writer.write_int_value("version", self.version)
    

