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 .progress_get_response_results_candidates_companies import ProgressGetResponse_results_candidates_companies
    from .progress_get_response_results_candidates_roles import ProgressGetResponse_results_candidates_roles
    from .progress_get_response_results_candidates_users import ProgressGetResponse_results_candidates_users

@dataclass
class ProgressGetResponse_results_candidates(Parsable):
    """
    Information about the users, roles, and companies who are eligible to take the next action in this step.
    """
    # Companies that can act in this step.
    companies: Optional[list[ProgressGetResponse_results_candidates_companies]] = None
    # Project roles that can act in this step.
    roles: Optional[list[ProgressGetResponse_results_candidates_roles]] = None
    # Individual users who can act in this step.
    users: Optional[list[ProgressGetResponse_results_candidates_users]] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> ProgressGetResponse_results_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: ProgressGetResponse_results_candidates
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return ProgressGetResponse_results_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 .progress_get_response_results_candidates_companies import ProgressGetResponse_results_candidates_companies
        from .progress_get_response_results_candidates_roles import ProgressGetResponse_results_candidates_roles
        from .progress_get_response_results_candidates_users import ProgressGetResponse_results_candidates_users

        from .progress_get_response_results_candidates_companies import ProgressGetResponse_results_candidates_companies
        from .progress_get_response_results_candidates_roles import ProgressGetResponse_results_candidates_roles
        from .progress_get_response_results_candidates_users import ProgressGetResponse_results_candidates_users

        fields: dict[str, Callable[[Any], None]] = {
            "companies": lambda n : setattr(self, 'companies', n.get_collection_of_object_values(ProgressGetResponse_results_candidates_companies)),
            "roles": lambda n : setattr(self, 'roles', n.get_collection_of_object_values(ProgressGetResponse_results_candidates_roles)),
            "users": lambda n : setattr(self, 'users', n.get_collection_of_object_values(ProgressGetResponse_results_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)
    

