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 .workflows_post_request_body_additional_approval_status_options import WorkflowsPostRequestBody_additionalApprovalStatusOptions
    from .workflows_post_request_body_additional_options import WorkflowsPostRequestBody_additionalOptions
    from .workflows_post_request_body_copy_files_options import WorkflowsPostRequestBody_copyFilesOptions
    from .workflows_post_request_body_steps import WorkflowsPostRequestBody_steps

@dataclass
class WorkflowsPostRequestBody(Parsable):
    # Custom approval statuses to add in addition to the built-in statuses (``APPROVED``, ``REJECTED``). You can define up to 50.
    additional_approval_status_options: Optional[list[WorkflowsPostRequestBody_additionalApprovalStatusOptions]] = None
    # Workflow-level settings that control whether the initiator can modify certain fields when starting a review.
    additional_options: Optional[WorkflowsPostRequestBody_additionalOptions] = None
    # (``Copy approved files`` in the UI) The configuration for copying approved files to a target folder when the review is complete.
    copy_files_options: Optional[WorkflowsPostRequestBody_copyFilesOptions] = None
    # A description of the workflow.Max length: 4096
    description: Optional[str] = None
    # The name of the workflow. It must be unique within the project.Max length: 255
    name: Optional[str] = None
    # A custom note associated with the workflow. Visible to all reviewers during the review process.Max length: 4096
    notes: Optional[str] = None
    # Defines the sequence of steps in the workflow. Steps run in the order they appear.
    steps: Optional[list[WorkflowsPostRequestBody_steps]] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WorkflowsPostRequestBody:
        """
        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: WorkflowsPostRequestBody
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WorkflowsPostRequestBody()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .workflows_post_request_body_additional_approval_status_options import WorkflowsPostRequestBody_additionalApprovalStatusOptions
        from .workflows_post_request_body_additional_options import WorkflowsPostRequestBody_additionalOptions
        from .workflows_post_request_body_copy_files_options import WorkflowsPostRequestBody_copyFilesOptions
        from .workflows_post_request_body_steps import WorkflowsPostRequestBody_steps

        from .workflows_post_request_body_additional_approval_status_options import WorkflowsPostRequestBody_additionalApprovalStatusOptions
        from .workflows_post_request_body_additional_options import WorkflowsPostRequestBody_additionalOptions
        from .workflows_post_request_body_copy_files_options import WorkflowsPostRequestBody_copyFilesOptions
        from .workflows_post_request_body_steps import WorkflowsPostRequestBody_steps

        fields: dict[str, Callable[[Any], None]] = {
            "additionalApprovalStatusOptions": lambda n : setattr(self, 'additional_approval_status_options', n.get_collection_of_object_values(WorkflowsPostRequestBody_additionalApprovalStatusOptions)),
            "additionalOptions": lambda n : setattr(self, 'additional_options', n.get_object_value(WorkflowsPostRequestBody_additionalOptions)),
            "copyFilesOptions": lambda n : setattr(self, 'copy_files_options', n.get_object_value(WorkflowsPostRequestBody_copyFilesOptions)),
            "description": lambda n : setattr(self, 'description', n.get_str_value()),
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "notes": lambda n : setattr(self, 'notes', n.get_str_value()),
            "steps": lambda n : setattr(self, 'steps', n.get_collection_of_object_values(WorkflowsPostRequestBody_steps)),
        }
        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("additionalApprovalStatusOptions", self.additional_approval_status_options)
        writer.write_object_value("additionalOptions", self.additional_options)
        writer.write_object_value("copyFilesOptions", self.copy_files_options)
        writer.write_str_value("description", self.description)
        writer.write_str_value("name", self.name)
        writer.write_str_value("notes", self.notes)
        writer.write_collection_of_object_values("steps", self.steps)
    

