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

if TYPE_CHECKING:
    from .documents_get_response_results_approve_status import DocumentsGetResponse_results_approveStatus

@dataclass
class DocumentsGetResponse_results(Parsable):
    # The approval status of the file version.For more information, see `File Review Statuses <https://help.autodesk.com/view/DOCS/ENU/?guid=BIM360D_Document_Management_About_Reviews_Reviews_FAQs_Reference_html#file-review-statuses>`_ documentation.
    approve_status: Optional[DocumentsGetResponse_results_approveStatus] = None
    # The description of the document, if provided.
    description: Optional[str] = None
    # The file name of the document.
    file_name: Optional[str] = None
    # The type of folder that contains the document.
    folder_type: Optional[str] = None
    # Indicates whether the file is deleted.``true`` – The file is deleted, either directly or because its parent folder was deleted.``false`` – The file is not deleted.
    is_deleted: Optional[bool] = None
    # The date and time when the file was last updated, in ISO 8601 format.
    last_updated_at: Optional[datetime.datetime] = None
    # The name of the document.
    name: Optional[str] = None
    # The URN of the folder that contains the document.
    parent_folder_urn: Optional[str] = None
    # The revision label assigned to the document.
    revision_label: Optional[str] = None
    # The storage URN of the document. You can use the storage URN to download the document. For details, see the `Download Files </en/docs/acc/v1/tutorials/files/download-document-s3/>`_ tutorial.
    storage_urn: Optional[str] = None
    # The title of the document.
    title: Optional[str] = None
    # The Autodesk ID of the user who created the file. For details about the user, call `GET user </en/docs/acc/v1/reference/http/admin-projectsprojectId-users-userId-GET/>`_.
    updated_by: Optional[str] = None
    # The name of the user who last modified the document.
    updated_by_name: Optional[str] = None
    # The URN of the document.
    urn: Optional[str] = None
    # The version number of the document at the time the transmittal was issued.
    version: Optional[int] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> DocumentsGetResponse_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: DocumentsGetResponse_results
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return DocumentsGetResponse_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 .documents_get_response_results_approve_status import DocumentsGetResponse_results_approveStatus

        from .documents_get_response_results_approve_status import DocumentsGetResponse_results_approveStatus

        fields: dict[str, Callable[[Any], None]] = {
            "approveStatus": lambda n : setattr(self, 'approve_status', n.get_object_value(DocumentsGetResponse_results_approveStatus)),
            "description": lambda n : setattr(self, 'description', n.get_str_value()),
            "fileName": lambda n : setattr(self, 'file_name', n.get_str_value()),
            "folderType": lambda n : setattr(self, 'folder_type', n.get_str_value()),
            "isDeleted": lambda n : setattr(self, 'is_deleted', n.get_bool_value()),
            "lastUpdatedAt": lambda n : setattr(self, 'last_updated_at', n.get_datetime_value()),
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "parentFolderUrn": lambda n : setattr(self, 'parent_folder_urn', n.get_str_value()),
            "revisionLabel": lambda n : setattr(self, 'revision_label', n.get_str_value()),
            "storageUrn": lambda n : setattr(self, 'storage_urn', n.get_str_value()),
            "title": lambda n : setattr(self, 'title', 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("approveStatus", self.approve_status)
        writer.write_str_value("description", self.description)
        writer.write_str_value("fileName", self.file_name)
        writer.write_str_value("folderType", self.folder_type)
        writer.write_bool_value("isDeleted", self.is_deleted)
        writer.write_datetime_value("lastUpdatedAt", self.last_updated_at)
        writer.write_str_value("name", self.name)
        writer.write_str_value("parentFolderUrn", self.parent_folder_urn)
        writer.write_str_value("revisionLabel", self.revision_label)
        writer.write_str_value("storageUrn", self.storage_urn)
        writer.write_str_value("title", self.title)
        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)
    

