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 .versions_get_response_results_approve_status import VersionsGetResponse_results_approveStatus
    from .versions_get_response_results_review_content import VersionsGetResponse_results_reviewContent

@dataclass
class VersionsGetResponse_results(Parsable):
    # The approval status assigned to the file during the review.
    approve_status: Optional[VersionsGetResponse_results_approveStatus] = None
    # The URN of the version copied to the target folder after the file was approved.This field is only present if the workflow includes a copy action and the file was approved.
    copied_file_version_urn: Optional[str] = None
    # The URN of the file item this version belongs to.
    item_urn: Optional[str] = None
    # The name of the resulting file version.
    name: Optional[str] = None
    # Review-specific metadata related to the file version.
    review_content: Optional[VersionsGetResponse_results_reviewContent] = None
    # The URN of the file version currently under review.This value is used when retrieving the full approval and review history of a specific version.See `GET approval-statuses </en/docs/acc/v1/reference/http/reviews-getversionapprovalstatuses-GET/>`_ for more details.
    urn: Optional[str] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> VersionsGetResponse_results:
        """
        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: VersionsGetResponse_results
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return VersionsGetResponse_results()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .versions_get_response_results_approve_status import VersionsGetResponse_results_approveStatus
        from .versions_get_response_results_review_content import VersionsGetResponse_results_reviewContent

        from .versions_get_response_results_approve_status import VersionsGetResponse_results_approveStatus
        from .versions_get_response_results_review_content import VersionsGetResponse_results_reviewContent

        fields: dict[str, Callable[[Any], None]] = {
            "approveStatus": lambda n : setattr(self, 'approve_status', n.get_object_value(VersionsGetResponse_results_approveStatus)),
            "copiedFileVersionUrn": lambda n : setattr(self, 'copied_file_version_urn', n.get_str_value()),
            "itemUrn": lambda n : setattr(self, 'item_urn', n.get_str_value()),
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "reviewContent": lambda n : setattr(self, 'review_content', n.get_object_value(VersionsGetResponse_results_reviewContent)),
            "urn": lambda n : setattr(self, 'urn', 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_object_value("approveStatus", self.approve_status)
        writer.write_str_value("copiedFileVersionUrn", self.copied_file_version_urn)
        writer.write_str_value("itemUrn", self.item_urn)
        writer.write_str_value("name", self.name)
        writer.write_object_value("reviewContent", self.review_content)
        writer.write_str_value("urn", self.urn)
    

