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 .manifest_get_response_errors import ManifestGetResponse_errors
    from .manifest_get_response_schema import ManifestGetResponse_schema
    from .manifest_get_response_seed_files import ManifestGetResponse_seedFiles
    from .manifest_get_response_stats import ManifestGetResponse_stats
    from .manifest_get_response_status import ManifestGetResponse_status

@dataclass
class ManifestGetResponse(Parsable):
    # creation timestamp.
    created_at: Optional[datetime.datetime] = None
    # errors.
    errors: Optional[list[ManifestGetResponse_errors]] = None
    # project ID.
    project_id: Optional[UUID] = None
    # current schema version.Possible values: ``2.0.0``
    schema: Optional[ManifestGetResponse_schema] = None
    # seed files.
    seed_files: Optional[list[ManifestGetResponse_seedFiles]] = None
    # High level statistics about the diff index
    stats: Optional[list[ManifestGetResponse_stats]] = None
    # manifest status.Possible values: ``Failed``, ``Running``, ``Succeeded``
    status: Optional[ManifestGetResponse_status] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> ManifestGetResponse:
        """
        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: ManifestGetResponse
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return ManifestGetResponse()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .manifest_get_response_errors import ManifestGetResponse_errors
        from .manifest_get_response_schema import ManifestGetResponse_schema
        from .manifest_get_response_seed_files import ManifestGetResponse_seedFiles
        from .manifest_get_response_stats import ManifestGetResponse_stats
        from .manifest_get_response_status import ManifestGetResponse_status

        from .manifest_get_response_errors import ManifestGetResponse_errors
        from .manifest_get_response_schema import ManifestGetResponse_schema
        from .manifest_get_response_seed_files import ManifestGetResponse_seedFiles
        from .manifest_get_response_stats import ManifestGetResponse_stats
        from .manifest_get_response_status import ManifestGetResponse_status

        fields: dict[str, Callable[[Any], None]] = {
            "createdAt": lambda n : setattr(self, 'created_at', n.get_datetime_value()),
            "errors": lambda n : setattr(self, 'errors', n.get_collection_of_object_values(ManifestGetResponse_errors)),
            "projectId": lambda n : setattr(self, 'project_id', n.get_uuid_value()),
            "schema": lambda n : setattr(self, 'schema', n.get_enum_value(ManifestGetResponse_schema)),
            "seedFiles": lambda n : setattr(self, 'seed_files', n.get_collection_of_object_values(ManifestGetResponse_seedFiles)),
            "stats": lambda n : setattr(self, 'stats', n.get_collection_of_object_values(ManifestGetResponse_stats)),
            "status": lambda n : setattr(self, 'status', n.get_enum_value(ManifestGetResponse_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_datetime_value("createdAt", self.created_at)
        writer.write_collection_of_object_values("errors", self.errors)
        writer.write_uuid_value("projectId", self.project_id)
        writer.write_enum_value("schema", self.schema)
        writer.write_collection_of_object_values("seedFiles", self.seed_files)
        writer.write_collection_of_object_values("stats", self.stats)
        writer.write_enum_value("status", self.status)
    

