from __future__ import annotations
import datetime
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 .progress_get_response_results_action_by import ProgressGetResponse_results_actionBy
    from .progress_get_response_results_candidates import ProgressGetResponse_results_candidates
    from .progress_get_response_results_claimed_by import ProgressGetResponse_results_claimedBy
    from .progress_get_response_results_status import ProgressGetResponse_results_status

@dataclass
class ProgressGetResponse_results(Parsable):
    # Information about the user recorded when the step status is ``SUBMITTED`` or ``VOID``. In the Reviews UI, these statuses occur when a participant submits their decision or when a step is voided.
    action_by: Optional[ProgressGetResponse_results_actionBy] = None
    # Information about the users, roles, and companies who are eligible to take the next action in this step.
    candidates: Optional[ProgressGetResponse_results_candidates] = None
    # Information about the user who claimed the step.
    claimed_by: Optional[ProgressGetResponse_results_claimedBy] = None
    # The date and time when the step ended. This value is set when the step is completed, either by being submitted or voided.
    end_time: Optional[datetime.datetime] = None
    # Additional information recorded for this step in the review’s progress.
    notes: Optional[str] = None
    # The current status of the step. Possible values:- ``CLAIMED``: A user has claimed the step.- ``UNCLAIMED``: No user has claimed the step.- ``SUBMITTED``: A user submitted the step (e.g., approved/rejected/custom).- ``VOID``: The step was voided.
    status: Optional[ProgressGetResponse_results_status] = None
    # The ID of the review step this progress record relates to.
    step_id: Optional[str] = None
    # The name of the review step this progress record relates to.
    step_name: Optional[str] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> ProgressGetResponse_results:
        """
        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: ProgressGetResponse_results
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return ProgressGetResponse_results()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .progress_get_response_results_action_by import ProgressGetResponse_results_actionBy
        from .progress_get_response_results_candidates import ProgressGetResponse_results_candidates
        from .progress_get_response_results_claimed_by import ProgressGetResponse_results_claimedBy
        from .progress_get_response_results_status import ProgressGetResponse_results_status

        from .progress_get_response_results_action_by import ProgressGetResponse_results_actionBy
        from .progress_get_response_results_candidates import ProgressGetResponse_results_candidates
        from .progress_get_response_results_claimed_by import ProgressGetResponse_results_claimedBy
        from .progress_get_response_results_status import ProgressGetResponse_results_status

        fields: dict[str, Callable[[Any], None]] = {
            "actionBy": lambda n : setattr(self, 'action_by', n.get_object_value(ProgressGetResponse_results_actionBy)),
            "candidates": lambda n : setattr(self, 'candidates', n.get_object_value(ProgressGetResponse_results_candidates)),
            "claimedBy": lambda n : setattr(self, 'claimed_by', n.get_object_value(ProgressGetResponse_results_claimedBy)),
            "endTime": lambda n : setattr(self, 'end_time', n.get_datetime_value()),
            "notes": lambda n : setattr(self, 'notes', n.get_str_value()),
            "status": lambda n : setattr(self, 'status', n.get_enum_value(ProgressGetResponse_results_status)),
            "stepId": lambda n : setattr(self, 'step_id', n.get_str_value()),
            "stepName": lambda n : setattr(self, 'step_name', n.get_str_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_object_value("actionBy", self.action_by)
        writer.write_object_value("candidates", self.candidates)
        writer.write_object_value("claimedBy", self.claimed_by)
        writer.write_datetime_value("endTime", self.end_time)
        writer.write_str_value("notes", self.notes)
        writer.write_enum_value("status", self.status)
        writer.write_str_value("stepId", self.step_id)
        writer.write_str_value("stepName", self.step_name)
    

