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 .with_export_get_response_result import WithExportGetResponse_result
    from .with_export_get_response_status import WithExportGetResponse_status

@dataclass
class WithExportGetResponse(Parsable):
    # The ID of the sheets export job.
    id: Optional[UUID] = None
    # The result of a completed export job.- If the ``status`` is ``successful``, a downloadable signed URL will be included in the ``result.output`` object.- If the ``status`` value is ``failed`` (e.g., because some files were deleted), the ``result.error`` object will include details of the error.
    result: Optional[WithExportGetResponse_result] = None
    # The status of the sheets export job.Possible values: ``successful``, ``processing``, ``failed``
    status: Optional[WithExportGetResponse_status] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WithExportGetResponse:
        """
        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: WithExportGetResponse
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WithExportGetResponse()
    
    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_export_get_response_result import WithExportGetResponse_result
        from .with_export_get_response_status import WithExportGetResponse_status

        from .with_export_get_response_result import WithExportGetResponse_result
        from .with_export_get_response_status import WithExportGetResponse_status

        fields: dict[str, Callable[[Any], None]] = {
            "id": lambda n : setattr(self, 'id', n.get_uuid_value()),
            "result": lambda n : setattr(self, 'result', n.get_object_value(WithExportGetResponse_result)),
            "status": lambda n : setattr(self, 'status', n.get_enum_value(WithExportGetResponse_status)),
        }
        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("id", self.id)
        writer.write_object_value("result", self.result)
        writer.write_enum_value("status", self.status)
    

