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 .reviews_post_request_body_file_versions import ReviewsPostRequestBody_fileVersions
    from .reviews_post_request_body_workflow_options import ReviewsPostRequestBody_workflowOptions

@dataclass
class ReviewsPostRequestBody(Parsable):
    # The file versions to include in the review. Maximum: 1000 items.
    file_versions: Optional[list[ReviewsPostRequestBody_fileVersions]] = None
    # The name of the review. Maximum length: 255 characters.Max length: 255
    name: Optional[str] = None
    # A note about the review. In the UI, this appears as the ``Description`` field.Maximum length: 4096 characters.Max length: 4096
    notes: Optional[str] = None
    # The ID of the approval workflow used to create the review.To list available workflows, call `GET workflows </en/docs/acc/v1/reference/http/reviews-workflows-GET/>`_.
    workflow_id: Optional[UUID] = None
    # Optional parameters that override approval workflow settings for this review (for example, steps, copy settings, or additional options).
    workflow_options: Optional[list[ReviewsPostRequestBody_workflowOptions]] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> ReviewsPostRequestBody:
        """
        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: ReviewsPostRequestBody
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return ReviewsPostRequestBody()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .reviews_post_request_body_file_versions import ReviewsPostRequestBody_fileVersions
        from .reviews_post_request_body_workflow_options import ReviewsPostRequestBody_workflowOptions

        from .reviews_post_request_body_file_versions import ReviewsPostRequestBody_fileVersions
        from .reviews_post_request_body_workflow_options import ReviewsPostRequestBody_workflowOptions

        fields: dict[str, Callable[[Any], None]] = {
            "fileVersions": lambda n : setattr(self, 'file_versions', n.get_collection_of_object_values(ReviewsPostRequestBody_fileVersions)),
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "notes": lambda n : setattr(self, 'notes', n.get_str_value()),
            "workflowId": lambda n : setattr(self, 'workflow_id', n.get_uuid_value()),
            "workflowOptions": lambda n : setattr(self, 'workflow_options', n.get_collection_of_object_values(ReviewsPostRequestBody_workflowOptions)),
        }
        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_collection_of_object_values("fileVersions", self.file_versions)
        writer.write_str_value("name", self.name)
        writer.write_str_value("notes", self.notes)
        writer.write_uuid_value("workflowId", self.workflow_id)
        writer.write_collection_of_object_values("workflowOptions", self.workflow_options)
    

