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 .sheets_get_response_results_collection import SheetsGetResponse_results_collection
    from .sheets_get_response_results_version_set import SheetsGetResponse_results_versionSet
    from .sheets_get_response_results_viewable import SheetsGetResponse_results_viewable

@dataclass
class SheetsGetResponse_results(Parsable):
    # The collection object, if assigned. If no collection is assigned, this value is ``null``.
    collection: Optional[SheetsGetResponse_results_collection] = None
    # The time when the sheet was created, in ISO-8601 format (YYYY-MM-DDTHH:mm:ss.SSSZ).
    created_at: Optional[datetime.datetime] = None
    # The ID of the user who created the sheet.
    created_by: Optional[str] = None
    # The name of the user who created the sheet.
    created_by_name: Optional[str] = None
    # - ``true`` if the sheet has been deleted.- ``false`` if the sheet has not been deleted.
    deleted: Optional[bool] = None
    # The time when the sheet was deleted, in ISO-8601 format (YYYY-MM-DDTHH:mm:ss.SSSZ).
    deleted_at: Optional[datetime.datetime] = None
    # The ID of the user who deleted the sheet.
    deleted_by: Optional[str] = None
    # The name of the user who deleted the sheet.
    deleted_by_name: Optional[str] = None
    # The ID of the sheet.
    id: Optional[UUID] = None
    # - ``true`` if the sheet is the version with the most recent issuance date. This is only relevant if you uploaded multiple versions of the same sheet that were assigned the same number. The ``current`` sheet is the sheet with the most recent issuance date.- ``false`` if the sheet is not the version with the most recent issuance date.
    is_current: Optional[bool] = None
    # The number of the sheet.
    number: Optional[str] = None
    # The size of the sheet in pixels.
    paper_size: Optional[list[float]] = None
    # The tags of the sheet.
    tags: Optional[list[str]] = None
    # The title of the sheet.
    title: Optional[str] = None
    # The time when the sheet was last updated, in ISO-8601 format (YYYY-MM-DDTHH:mm:ss.SSSZ).
    updated_at: Optional[datetime.datetime] = None
    # The ID of the user who last updated the sheet.
    updated_by: Optional[str] = None
    # The name of the user who last updated the sheet.
    updated_by_name: Optional[str] = None
    # The name of the source file from which the sheet was generated.
    upload_file_name: Optional[str] = None
    # The ID of the upload that generated the sheet.
    upload_id: Optional[UUID] = None
    # Basic version set data. For a complete collection of version set data, call `GET version-sets </en/docs/acc/v1/reference/http/sheets-version-sets-GET/>`_.
    version_set: Optional[SheetsGetResponse_results_versionSet] = None
    # Information about the sheet relevant for loading the sheet to the Viewer. See `Add Viewer to an HTML Page <https://forge.autodesk.com/en/docs/viewer/v7/developers_guide/viewer_basics/>`_ for more information.
    viewable: Optional[SheetsGetResponse_results_viewable] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> SheetsGetResponse_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: SheetsGetResponse_results
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return SheetsGetResponse_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 .sheets_get_response_results_collection import SheetsGetResponse_results_collection
        from .sheets_get_response_results_version_set import SheetsGetResponse_results_versionSet
        from .sheets_get_response_results_viewable import SheetsGetResponse_results_viewable

        from .sheets_get_response_results_collection import SheetsGetResponse_results_collection
        from .sheets_get_response_results_version_set import SheetsGetResponse_results_versionSet
        from .sheets_get_response_results_viewable import SheetsGetResponse_results_viewable

        fields: dict[str, Callable[[Any], None]] = {
            "collection": lambda n : setattr(self, 'collection', n.get_object_value(SheetsGetResponse_results_collection)),
            "createdAt": lambda n : setattr(self, 'created_at', n.get_datetime_value()),
            "createdBy": lambda n : setattr(self, 'created_by', n.get_str_value()),
            "createdByName": lambda n : setattr(self, 'created_by_name', n.get_str_value()),
            "deleted": lambda n : setattr(self, 'deleted', n.get_bool_value()),
            "deletedAt": lambda n : setattr(self, 'deleted_at', n.get_datetime_value()),
            "deletedBy": lambda n : setattr(self, 'deleted_by', n.get_str_value()),
            "deletedByName": lambda n : setattr(self, 'deleted_by_name', n.get_str_value()),
            "id": lambda n : setattr(self, 'id', n.get_uuid_value()),
            "isCurrent": lambda n : setattr(self, 'is_current', n.get_bool_value()),
            "number": lambda n : setattr(self, 'number', n.get_str_value()),
            "paperSize": lambda n : setattr(self, 'paper_size', n.get_collection_of_primitive_values(float)),
            "tags": lambda n : setattr(self, 'tags', n.get_collection_of_primitive_values(str)),
            "title": lambda n : setattr(self, 'title', n.get_str_value()),
            "updatedAt": lambda n : setattr(self, 'updated_at', n.get_datetime_value()),
            "updatedBy": lambda n : setattr(self, 'updated_by', n.get_str_value()),
            "updatedByName": lambda n : setattr(self, 'updated_by_name', n.get_str_value()),
            "uploadFileName": lambda n : setattr(self, 'upload_file_name', n.get_str_value()),
            "uploadId": lambda n : setattr(self, 'upload_id', n.get_uuid_value()),
            "versionSet": lambda n : setattr(self, 'version_set', n.get_object_value(SheetsGetResponse_results_versionSet)),
            "viewable": lambda n : setattr(self, 'viewable', n.get_object_value(SheetsGetResponse_results_viewable)),
        }
        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("collection", self.collection)
        writer.write_datetime_value("createdAt", self.created_at)
        writer.write_str_value("createdBy", self.created_by)
        writer.write_str_value("createdByName", self.created_by_name)
        writer.write_bool_value("deleted", self.deleted)
        writer.write_datetime_value("deletedAt", self.deleted_at)
        writer.write_str_value("deletedBy", self.deleted_by)
        writer.write_str_value("deletedByName", self.deleted_by_name)
        writer.write_uuid_value("id", self.id)
        writer.write_bool_value("isCurrent", self.is_current)
        writer.write_str_value("number", self.number)
        writer.write_collection_of_primitive_values("paperSize", self.paper_size)
        writer.write_collection_of_primitive_values("tags", self.tags)
        writer.write_str_value("title", self.title)
        writer.write_datetime_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("uploadFileName", self.upload_file_name)
        writer.write_uuid_value("uploadId", self.upload_id)
        writer.write_object_value("versionSet", self.version_set)
        writer.write_object_value("viewable", self.viewable)
    

