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

@dataclass
class WithJobGetResponse(Parsable):
    # The account ID.
    account_id: Optional[UUID] = None
    # The date and time the job was completed, presented in ISO 8601 format. If the job has not yet completed, the value is null.
    completed_at: Optional[datetime.datetime] = None
    # The completion status for completed jobs. Possible values: ``success``, ``failed``, ``cancelled``.
    completion_status: Optional[str] = None
    # The date and time the job was created, presented in ISO 8601 format.
    created_at: Optional[datetime.datetime] = None
    # The BIM 360 / ACC user ID of the user who created the data request that spawned this job.
    created_by: Optional[str] = None
    # The email address of the user who created the data request that spawned this job.
    created_by_email: Optional[str] = None
    # The end date and time for the data extraction, in ISO 8601 format.This field applies only to schemas that support date range extraction. The detailed schema documentation delivered with each data extract identifies the schemas and tables that support date range extraction.
    end_date: Optional[str] = None
    # The job ID.
    id: Optional[UUID] = None
    # The last date and time that a user downloaded this job data, in ISO 8601 format.
    last_downloaded_at: Optional[datetime.datetime] = None
    # The ID of the user who last downloaded this job data.
    last_downloaded_by: Optional[str] = None
    # Job progress indicator (0 to 100 percent)
    progress: Optional[int] = None
    # The project ID.
    project_id: Optional[UUID] = None
    # The list of project IDs
    project_id_list: Optional[list[str]] = None
    # The ID of the data request that spawned the job.
    request_id: Optional[UUID] = None
    # Send a notification email when the job completes.
    send_email: Optional[bool] = None
    # The start date and time for the data extraction, in ISO 8601 format.This field applies only to schemas that support date range extraction. The detailed schema documentation delivered with each data extract identifies the schemas and tables that support date range extraction.
    start_date: Optional[str] = None
    # The date and time the job was started, presented in ISO 8601 format. If the job has not yet started, the value is null.
    started_at: Optional[datetime.datetime] = None
    # The current status of the job. Possible values: ``queued``, ``running``, ``complete``.
    status: Optional[str] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WithJobGetResponse:
        """
        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: WithJobGetResponse
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WithJobGetResponse()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        fields: dict[str, Callable[[Any], None]] = {
            "accountId": lambda n : setattr(self, 'account_id', n.get_uuid_value()),
            "completedAt": lambda n : setattr(self, 'completed_at', n.get_datetime_value()),
            "completionStatus": lambda n : setattr(self, 'completion_status', n.get_str_value()),
            "createdAt": lambda n : setattr(self, 'created_at', n.get_datetime_value()),
            "createdBy": lambda n : setattr(self, 'created_by', n.get_str_value()),
            "createdByEmail": lambda n : setattr(self, 'created_by_email', n.get_str_value()),
            "endDate": lambda n : setattr(self, 'end_date', n.get_str_value()),
            "id": lambda n : setattr(self, 'id', n.get_uuid_value()),
            "lastDownloadedAt": lambda n : setattr(self, 'last_downloaded_at', n.get_datetime_value()),
            "lastDownloadedBy": lambda n : setattr(self, 'last_downloaded_by', n.get_str_value()),
            "progress": lambda n : setattr(self, 'progress', n.get_int_value()),
            "projectId": lambda n : setattr(self, 'project_id', n.get_uuid_value()),
            "projectIdList": lambda n : setattr(self, 'project_id_list', n.get_collection_of_primitive_values(str)),
            "requestId": lambda n : setattr(self, 'request_id', n.get_uuid_value()),
            "sendEmail": lambda n : setattr(self, 'send_email', n.get_bool_value()),
            "startDate": lambda n : setattr(self, 'start_date', n.get_str_value()),
            "startedAt": lambda n : setattr(self, 'started_at', n.get_datetime_value()),
            "status": lambda n : setattr(self, 'status', n.get_str_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_uuid_value("accountId", self.account_id)
        writer.write_datetime_value("completedAt", self.completed_at)
        writer.write_str_value("completionStatus", self.completion_status)
        writer.write_datetime_value("createdAt", self.created_at)
        writer.write_str_value("createdBy", self.created_by)
        writer.write_str_value("createdByEmail", self.created_by_email)
        writer.write_str_value("endDate", self.end_date)
        writer.write_uuid_value("id", self.id)
        writer.write_datetime_value("lastDownloadedAt", self.last_downloaded_at)
        writer.write_str_value("lastDownloadedBy", self.last_downloaded_by)
        writer.write_int_value("progress", self.progress)
        writer.write_uuid_value("projectId", self.project_id)
        writer.write_collection_of_primitive_values("projectIdList", self.project_id_list)
        writer.write_uuid_value("requestId", self.request_id)
        writer.write_bool_value("sendEmail", self.send_email)
        writer.write_str_value("startDate", self.start_date)
        writer.write_datetime_value("startedAt", self.started_at)
        writer.write_str_value("status", self.status)
    

