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

if TYPE_CHECKING:
    from .metadata_get_response_region import MetadataGetResponse_region
    from .metadata_get_response_versions import MetadataGetResponse_versions

@dataclass
class MetadataGetResponse(Parsable):
    # The ACC project ID.
    project_id: Optional[str] = None
    # The region of the specification PDFs that were uploaded for this project. Currently, AutoSpecs supports CSI MasterFormat for the United States and Canada.Possible values: ``USA``, ``Canada``, ``Others``
    region: Optional[MetadataGetResponse_region] = None
    # Information about the versions for the project.
    versions: Optional[list[MetadataGetResponse_versions]] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> MetadataGetResponse:
        """
        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: MetadataGetResponse
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return MetadataGetResponse()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .metadata_get_response_region import MetadataGetResponse_region
        from .metadata_get_response_versions import MetadataGetResponse_versions

        from .metadata_get_response_region import MetadataGetResponse_region
        from .metadata_get_response_versions import MetadataGetResponse_versions

        fields: dict[str, Callable[[Any], None]] = {
            "projectId": lambda n : setattr(self, 'project_id', n.get_str_value()),
            "region": lambda n : setattr(self, 'region', n.get_enum_value(MetadataGetResponse_region)),
            "versions": lambda n : setattr(self, 'versions', n.get_collection_of_object_values(MetadataGetResponse_versions)),
        }
        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_str_value("projectId", self.project_id)
        writer.write_enum_value("region", self.region)
        writer.write_collection_of_object_values("versions", self.versions)
    

