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 .workflow_get_response_steps_group_review_type import WorkflowGetResponse_steps_groupReview_type

@dataclass
class WorkflowGetResponse_steps_groupReview(Parsable):
    """
    (``Reviewer Type`` in the UI) Defines whether multiple reviewers can participate in this step and how their responses are handled. It applies only to ``REVIEWER`` steps.
    """
    # Indicates whether group review is enabled for this step.``true``: multiple reviewers can participate in the step.``false``: (default) only a single reviewer is allowed.
    enabled: Optional[bool] = None
    # The minimum number of reviewers required for this step. This field is set automatically when the group review type is set to ``MINIMUM``. It is not independently configurable. Valid range: ``1–30``.
    min: Optional[int] = None
    # (Displayed under ``More options`` in the UI) Specifies the group review rule for this step.Possible values:- ``ALL``: every reviewer assigned to the step must submit a response (up to 30).- ``MINIMUM``: only a specified number of reviewers must respond, as defined in ``min``.
    type: Optional[WorkflowGetResponse_steps_groupReview_type] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WorkflowGetResponse_steps_groupReview:
        """
        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_steps_groupReview
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WorkflowGetResponse_steps_groupReview()
    
    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_steps_group_review_type import WorkflowGetResponse_steps_groupReview_type

        from .workflow_get_response_steps_group_review_type import WorkflowGetResponse_steps_groupReview_type

        fields: dict[str, Callable[[Any], None]] = {
            "enabled": lambda n : setattr(self, 'enabled', n.get_bool_value()),
            "min": lambda n : setattr(self, 'min', n.get_int_value()),
            "type": lambda n : setattr(self, 'type', n.get_enum_value(WorkflowGetResponse_steps_groupReview_type)),
        }
        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("enabled", self.enabled)
        writer.write_int_value("min", self.min)
        writer.write_enum_value("type", self.type)
    

