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_rfi_patch_response_permitted_actions_remaining_reviewers import WithRfiPatchResponse_permittedActions_remainingReviewers
    from .with_rfi_patch_response_permitted_actions_update_rfi import WithRfiPatchResponse_permittedActions_updateRfi

@dataclass
class WithRfiPatchResponse_permittedActions(Parsable):
    # ``true``: The user can create a comment for the RFI.``false`` (default): The user cannot create a comment for the RFI.
    create_comment: Optional[bool] = None
    # ``true`` if the user can add a document reference to the RFI.``false`` if the user cannot add a document reference to the RFI.
    create_document_reference: Optional[bool] = None
    # ``true``: The user can create a response for the RFI.``false``: The user cannot create a response for the RFI.
    create_response: Optional[bool] = None
    # ``true``: The user can create a response on behalf of another user for the RFI.``false``: The user cannot create a response on behalf of another user for the RFI.
    create_response_on_behalf: Optional[bool] = None
    # Not relevant
    nudge: Optional[bool] = None
    # A list of users who are still expected to review the RFI.
    remaining_reviewers: Optional[list[WithRfiPatchResponse_permittedActions_remainingReviewers]] = None
    # ``true``: The user can remove a document reference to the RFI.``false``: The user cannot remove a document reference to the RFI.
    remove_document_reference: Optional[bool] = None
    # Not relevant
    share: Optional[bool] = None
    # The list of attributes and statuses available  for the user.
    update_rfi: Optional[WithRfiPatchResponse_permittedActions_updateRfi] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WithRfiPatchResponse_permittedActions:
        """
        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: WithRfiPatchResponse_permittedActions
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WithRfiPatchResponse_permittedActions()
    
    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_rfi_patch_response_permitted_actions_remaining_reviewers import WithRfiPatchResponse_permittedActions_remainingReviewers
        from .with_rfi_patch_response_permitted_actions_update_rfi import WithRfiPatchResponse_permittedActions_updateRfi

        from .with_rfi_patch_response_permitted_actions_remaining_reviewers import WithRfiPatchResponse_permittedActions_remainingReviewers
        from .with_rfi_patch_response_permitted_actions_update_rfi import WithRfiPatchResponse_permittedActions_updateRfi

        fields: dict[str, Callable[[Any], None]] = {
            "createComment": lambda n : setattr(self, 'create_comment', n.get_bool_value()),
            "createDocumentReference": lambda n : setattr(self, 'create_document_reference', n.get_bool_value()),
            "createResponse": lambda n : setattr(self, 'create_response', n.get_bool_value()),
            "createResponseOnBehalf": lambda n : setattr(self, 'create_response_on_behalf', n.get_bool_value()),
            "nudge": lambda n : setattr(self, 'nudge', n.get_bool_value()),
            "remainingReviewers": lambda n : setattr(self, 'remaining_reviewers', n.get_collection_of_object_values(WithRfiPatchResponse_permittedActions_remainingReviewers)),
            "removeDocumentReference": lambda n : setattr(self, 'remove_document_reference', n.get_bool_value()),
            "share": lambda n : setattr(self, 'share', n.get_bool_value()),
            "updateRfi": lambda n : setattr(self, 'update_rfi', n.get_object_value(WithRfiPatchResponse_permittedActions_updateRfi)),
        }
        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_bool_value("createComment", self.create_comment)
        writer.write_bool_value("createDocumentReference", self.create_document_reference)
        writer.write_bool_value("createResponse", self.create_response)
        writer.write_bool_value("createResponseOnBehalf", self.create_response_on_behalf)
        writer.write_bool_value("nudge", self.nudge)
        writer.write_collection_of_object_values("remainingReviewers", self.remaining_reviewers)
        writer.write_bool_value("removeDocumentReference", self.remove_document_reference)
        writer.write_bool_value("share", self.share)
        writer.write_object_value("updateRfi", self.update_rfi)
    

