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 .with_workflow_get_response_steps_candidates import WithWorkflowGetResponse_steps_candidates
    from .with_workflow_get_response_steps_due_date_type import WithWorkflowGetResponse_steps_dueDateType
    from .with_workflow_get_response_steps_group_review import WithWorkflowGetResponse_steps_groupReview
    from .with_workflow_get_response_steps_type import WithWorkflowGetResponse_steps_type

@dataclass
class WithWorkflowGetResponse_steps(Parsable):
    # (Displayed in the UI when selecting reviewers for a step)Lists the users, roles, or companies that were configured as reviewers for this step.These candidates are defined during workflow setup and determine who will be invited to participate in the step during a review.
    candidates: Optional[WithWorkflowGetResponse_steps_candidates] = None
    # Specifies how the due date is calculated for this step. It works together with duration.This field applies only to ``REVIEWER`` and ``APPROVER`` steps.Possible values:- ``CALENDAR_DAY`` (default): the due date includes all calendar days, including weekends and holidays.- ``WORKDAY``: the due date excludes weekends and project holidays.
    due_date_type: Optional[WithWorkflowGetResponse_steps_dueDateType] = None
    # (``Time allowed`` in the UI) The number of days allocated to complete this step.This field applies only to ``REVIEWER`` and ``APPROVER`` steps. It is used to calculate the due date based on the selected ``dueDateType``.Valid range: ``1–99``.
    duration: Optional[int] = None
    # (``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.
    group_review: Optional[WithWorkflowGetResponse_steps_groupReview] = None
    # The ID of the step.
    id: Optional[str] = None
    # The name of the step, as defined in the workflow. It appears in the UI and is used in workflow configuration. Maximum length: 255 characters.Max length: 255
    name: Optional[str] = None
    # Indicates the step type in the workflow. Possible values:- ``INITIATOR``: the first step. It typically represents the person who launches the review.- ``REVIEWER``: an intermediate step. It allows one or more reviewers to evaluate the files.- ``APPROVER``: the final step. It represents the decision maker who approves or rejects the files.
    type: Optional[WithWorkflowGetResponse_steps_type] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WithWorkflowGetResponse_steps:
        """
        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_steps
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WithWorkflowGetResponse_steps()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .with_workflow_get_response_steps_candidates import WithWorkflowGetResponse_steps_candidates
        from .with_workflow_get_response_steps_due_date_type import WithWorkflowGetResponse_steps_dueDateType
        from .with_workflow_get_response_steps_group_review import WithWorkflowGetResponse_steps_groupReview
        from .with_workflow_get_response_steps_type import WithWorkflowGetResponse_steps_type

        from .with_workflow_get_response_steps_candidates import WithWorkflowGetResponse_steps_candidates
        from .with_workflow_get_response_steps_due_date_type import WithWorkflowGetResponse_steps_dueDateType
        from .with_workflow_get_response_steps_group_review import WithWorkflowGetResponse_steps_groupReview
        from .with_workflow_get_response_steps_type import WithWorkflowGetResponse_steps_type

        fields: dict[str, Callable[[Any], None]] = {
            "candidates": lambda n : setattr(self, 'candidates', n.get_object_value(WithWorkflowGetResponse_steps_candidates)),
            "dueDateType": lambda n : setattr(self, 'due_date_type', n.get_enum_value(WithWorkflowGetResponse_steps_dueDateType)),
            "duration": lambda n : setattr(self, 'duration', n.get_int_value()),
            "groupReview": lambda n : setattr(self, 'group_review', n.get_object_value(WithWorkflowGetResponse_steps_groupReview)),
            "id": lambda n : setattr(self, 'id', n.get_str_value()),
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "type": lambda n : setattr(self, 'type', n.get_enum_value(WithWorkflowGetResponse_steps_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_object_value("candidates", self.candidates)
        writer.write_enum_value("dueDateType", self.due_date_type)
        writer.write_int_value("duration", self.duration)
        writer.write_object_value("groupReview", self.group_review)
        writer.write_str_value("id", self.id)
        writer.write_str_value("name", self.name)
        writer.write_enum_value("type", self.type)
    

