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 .with_upload_get_response_status import WithUploadGetResponse_status

@dataclass
class WithUploadGetResponse(Parsable):
    # The time when the upload 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 upload.
    created_by: Optional[str] = None
    # The name of the user who created the upload.
    created_by_name: Optional[str] = None
    # The ID of the upload.
    id: Optional[UUID] = None
    # The time when all the review sheets of the upload were published, in ISO-8601 format (YYYY-MM-DDTHH:mm:ss.SSSZ).
    published_at: Optional[datetime.datetime] = None
    # The ID of the user who published all the review sheets of the upload.
    published_by: Optional[str] = None
    # The name of the user who published all the review sheets of the upload.
    published_by_name: Optional[str] = None
    # The number of files that have been published by the upload.
    published_count: Optional[int] = None
    # The status of the upload. Possible values:- ``PENDING``: the uploaded files are waiting for to be processed.- ``PROCESSING``: the uploaded files are being processed.- ``IN_REVIEW``: the file upload process is complete. The sheets are ready for review. You can now call `GET review-sheets </en/docs/acc/v1/reference/http/sheets-review-sheets-GET/>`_, `PATCH review-sheets </en/docs/acc/v1/reference/http/sheets-review-sheets-PATCH/>`_, or `POST review-sheets:publish </en/docs/acc/v1/reference/http/sheets-review-sheetspublish-POST/>`_.- ``FAILED``: the file upload process failed. One of the final status of an upload.- ``UPDATING_VERSION_SET``: the target version set is being updated.- ``PUBLISHING``: the review sheets are being published.- ``PUBLISHED``: the review sheets have been published.
    status: Optional[WithUploadGetResponse_status] = None
    # The time when the upload 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 upload.
    updated_by: Optional[str] = None
    # The name of the user who last updated the upload.
    updated_by_name: Optional[str] = None
    # The ID of the version set where the upload creates sheets to.
    version_set_id: Optional[UUID] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WithUploadGetResponse:
        """
        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: WithUploadGetResponse
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WithUploadGetResponse()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .with_upload_get_response_status import WithUploadGetResponse_status

        from .with_upload_get_response_status import WithUploadGetResponse_status

        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()),
            "createdByName": lambda n : setattr(self, 'created_by_name', n.get_str_value()),
            "id": lambda n : setattr(self, 'id', n.get_uuid_value()),
            "publishedAt": lambda n : setattr(self, 'published_at', n.get_datetime_value()),
            "publishedBy": lambda n : setattr(self, 'published_by', n.get_str_value()),
            "publishedByName": lambda n : setattr(self, 'published_by_name', n.get_str_value()),
            "publishedCount": lambda n : setattr(self, 'published_count', n.get_int_value()),
            "status": lambda n : setattr(self, 'status', n.get_enum_value(WithUploadGetResponse_status)),
            "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()),
            "versionSetId": lambda n : setattr(self, 'version_set_id', n.get_uuid_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_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_uuid_value("id", self.id)
        writer.write_datetime_value("publishedAt", self.published_at)
        writer.write_str_value("publishedBy", self.published_by)
        writer.write_str_value("publishedByName", self.published_by_name)
        writer.write_int_value("publishedCount", self.published_count)
        writer.write_enum_value("status", self.status)
        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_uuid_value("versionSetId", self.version_set_id)
    

