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 .reviews_get_response_results_next_action_by_candidates import ReviewsGetResponse_results_nextActionBy_candidates
    from .reviews_get_response_results_next_action_by_claimed_by import ReviewsGetResponse_results_nextActionBy_claimedBy

@dataclass
class ReviewsGetResponse_results_nextActionBy(Parsable):
    """
    Information about the claimers and candidates responsible for the current step.
    """
    # Information about the users, roles, and companies who are eligible to take the next action in this step.
    candidates: Optional[ReviewsGetResponse_results_nextActionBy_candidates] = None
    # A list of users who have already claimed the current step.
    claimed_by: Optional[list[ReviewsGetResponse_results_nextActionBy_claimedBy]] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> ReviewsGetResponse_results_nextActionBy:
        """
        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: ReviewsGetResponse_results_nextActionBy
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return ReviewsGetResponse_results_nextActionBy()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .reviews_get_response_results_next_action_by_candidates import ReviewsGetResponse_results_nextActionBy_candidates
        from .reviews_get_response_results_next_action_by_claimed_by import ReviewsGetResponse_results_nextActionBy_claimedBy

        from .reviews_get_response_results_next_action_by_candidates import ReviewsGetResponse_results_nextActionBy_candidates
        from .reviews_get_response_results_next_action_by_claimed_by import ReviewsGetResponse_results_nextActionBy_claimedBy

        fields: dict[str, Callable[[Any], None]] = {
            "candidates": lambda n : setattr(self, 'candidates', n.get_object_value(ReviewsGetResponse_results_nextActionBy_candidates)),
            "claimedBy": lambda n : setattr(self, 'claimed_by', n.get_collection_of_object_values(ReviewsGetResponse_results_nextActionBy_claimedBy)),
        }
        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_collection_of_object_values("claimedBy", self.claimed_by)
    

