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 .workflow_get_response_additional_options import WorkflowGetResponse_additionalOptions
    from .workflow_get_response_approval_status_options import WorkflowGetResponse_approvalStatusOptions
    from .workflow_get_response_attached_attributes import WorkflowGetResponse_attachedAttributes
    from .workflow_get_response_copy_files_options import WorkflowGetResponse_copyFilesOptions
    from .workflow_get_response_steps import WorkflowGetResponse_steps
    from .workflow_get_response_update_attributes_options import WorkflowGetResponse_updateAttributesOptions

@dataclass
class WorkflowGetResponse(Parsable):
    # Workflow-level settings that control whether the initiator can modify certain fields when starting a review.
    additional_options: Optional[WorkflowGetResponse_additionalOptions] = None
    # A list of file review status options to the workflow, which contains two built in options returned by the system.
    approval_status_options: Optional[list[WorkflowGetResponse_approvalStatusOptions]] = None
    # (``Update Attributes`` in the UI)The list of attributes added in the ``Update Attributes`` action.These attributes will be applied to the approved files in the target folder, or optionally also in the source folder depending on the configuration.
    attached_attributes: Optional[list[WorkflowGetResponse_attachedAttributes]] = 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[WorkflowGetResponse_copyFilesOptions] = None
    # A description of the workflow.Max length: 4096
    description: Optional[str] = None
    # The ID of the workflow.
    id: Optional[UUID] = 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
    # A list of steps specify the details for each step in the workflow.
    steps: Optional[list[WorkflowGetResponse_steps]] = None
    # The configuration for applying attribute updates when a review is completed.This applies only if the workflow includes a file copy action and the ``Update Attributes`` action is enabled.
    update_attributes_options: Optional[WorkflowGetResponse_updateAttributesOptions] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WorkflowGetResponse:
        """
        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: WorkflowGetResponse
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WorkflowGetResponse()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .workflow_get_response_additional_options import WorkflowGetResponse_additionalOptions
        from .workflow_get_response_approval_status_options import WorkflowGetResponse_approvalStatusOptions
        from .workflow_get_response_attached_attributes import WorkflowGetResponse_attachedAttributes
        from .workflow_get_response_copy_files_options import WorkflowGetResponse_copyFilesOptions
        from .workflow_get_response_steps import WorkflowGetResponse_steps
        from .workflow_get_response_update_attributes_options import WorkflowGetResponse_updateAttributesOptions

        from .workflow_get_response_additional_options import WorkflowGetResponse_additionalOptions
        from .workflow_get_response_approval_status_options import WorkflowGetResponse_approvalStatusOptions
        from .workflow_get_response_attached_attributes import WorkflowGetResponse_attachedAttributes
        from .workflow_get_response_copy_files_options import WorkflowGetResponse_copyFilesOptions
        from .workflow_get_response_steps import WorkflowGetResponse_steps
        from .workflow_get_response_update_attributes_options import WorkflowGetResponse_updateAttributesOptions

        fields: dict[str, Callable[[Any], None]] = {
            "additionalOptions": lambda n : setattr(self, 'additional_options', n.get_object_value(WorkflowGetResponse_additionalOptions)),
            "approvalStatusOptions": lambda n : setattr(self, 'approval_status_options', n.get_collection_of_object_values(WorkflowGetResponse_approvalStatusOptions)),
            "attachedAttributes": lambda n : setattr(self, 'attached_attributes', n.get_collection_of_object_values(WorkflowGetResponse_attachedAttributes)),
            "copyFilesOptions": lambda n : setattr(self, 'copy_files_options', n.get_object_value(WorkflowGetResponse_copyFilesOptions)),
            "description": lambda n : setattr(self, 'description', n.get_str_value()),
            "id": lambda n : setattr(self, 'id', n.get_uuid_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(WorkflowGetResponse_steps)),
            "updateAttributesOptions": lambda n : setattr(self, 'update_attributes_options', n.get_object_value(WorkflowGetResponse_updateAttributesOptions)),
        }
        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("additionalOptions", self.additional_options)
        writer.write_collection_of_object_values("approvalStatusOptions", self.approval_status_options)
        writer.write_collection_of_object_values("attachedAttributes", self.attached_attributes)
        writer.write_object_value("copyFilesOptions", self.copy_files_options)
        writer.write_str_value("description", self.description)
        writer.write_uuid_value("id", self.id)
        writer.write_str_value("name", self.name)
        writer.write_str_value("notes", self.notes)
        writer.write_collection_of_object_values("steps", self.steps)
        writer.write_object_value("updateAttributesOptions", self.update_attributes_options)
    

