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 .workflows_post_response_steps_candidates_companies import WorkflowsPostResponse_steps_candidates_companies
    from .workflows_post_response_steps_candidates_roles import WorkflowsPostResponse_steps_candidates_roles
    from .workflows_post_response_steps_candidates_users import WorkflowsPostResponse_steps_candidates_users

@dataclass
class WorkflowsPostResponse_steps_candidates(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.
    """
    # A list of companies assigned as candidates for this step.
    companies: Optional[list[WorkflowsPostResponse_steps_candidates_companies]] = None
    # A list of project roles assigned as candidates for this step.
    roles: Optional[list[WorkflowsPostResponse_steps_candidates_roles]] = None
    # A list of individual users assigned as candidates for this step.
    users: Optional[list[WorkflowsPostResponse_steps_candidates_users]] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WorkflowsPostResponse_steps_candidates:
        """
        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: WorkflowsPostResponse_steps_candidates
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WorkflowsPostResponse_steps_candidates()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .workflows_post_response_steps_candidates_companies import WorkflowsPostResponse_steps_candidates_companies
        from .workflows_post_response_steps_candidates_roles import WorkflowsPostResponse_steps_candidates_roles
        from .workflows_post_response_steps_candidates_users import WorkflowsPostResponse_steps_candidates_users

        from .workflows_post_response_steps_candidates_companies import WorkflowsPostResponse_steps_candidates_companies
        from .workflows_post_response_steps_candidates_roles import WorkflowsPostResponse_steps_candidates_roles
        from .workflows_post_response_steps_candidates_users import WorkflowsPostResponse_steps_candidates_users

        fields: dict[str, Callable[[Any], None]] = {
            "companies": lambda n : setattr(self, 'companies', n.get_collection_of_object_values(WorkflowsPostResponse_steps_candidates_companies)),
            "roles": lambda n : setattr(self, 'roles', n.get_collection_of_object_values(WorkflowsPostResponse_steps_candidates_roles)),
            "users": lambda n : setattr(self, 'users', n.get_collection_of_object_values(WorkflowsPostResponse_steps_candidates_users)),
        }
        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_collection_of_object_values("companies", self.companies)
        writer.write_collection_of_object_values("roles", self.roles)
        writer.write_collection_of_object_values("users", self.users)
    

