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

@dataclass
class WithWorkflowGetResponse_updateAttributesOptions(Parsable):
    """
    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`` in the UI)Indicates whether the ``Update Attributes`` action is enabled.``true``: attributes will be applied after the review.``false``: (default) attributes will not be updated.
    enable_attached_attributes: Optional[bool] = None
    # (``Update attributes both for target folder and source folder`` or ``Update attributes only for target folder`` in the UI)Determines whether attributes are updated only for files in the target folder, or for both the target and source folders.``true``: update attributes in both folders.``false``: (default) update only the target folder.Only available when the approval workflow includes a copy post-action.
    update_source_and_copied_files: Optional[bool] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WithWorkflowGetResponse_updateAttributesOptions:
        """
        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: WithWorkflowGetResponse_updateAttributesOptions
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WithWorkflowGetResponse_updateAttributesOptions()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        fields: dict[str, Callable[[Any], None]] = {
            "enableAttachedAttributes": lambda n : setattr(self, 'enable_attached_attributes', n.get_bool_value()),
            "updateSourceAndCopiedFiles": lambda n : setattr(self, 'update_source_and_copied_files', n.get_bool_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_bool_value("enableAttachedAttributes", self.enable_attached_attributes)
        writer.write_bool_value("updateSourceAndCopiedFiles", self.update_source_and_copied_files)
    

