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_response_patch_response_rfi_permitted_actions_update_rfi_permitted_attributes import WithResponsePatchResponse_rfi_permittedActions_updateRfi_permittedAttributes
    from .with_response_patch_response_rfi_permitted_actions_update_rfi_permitted_statuses import WithResponsePatchResponse_rfi_permittedActions_updateRfi_permittedStatuses

@dataclass
class WithResponsePatchResponse_rfi_permittedActions_updateRfi(Parsable):
    """
    Information about the user who most recently updated the RFI.
    """
    # The list of attributes that are required when creating an RFI.
    permitted_attributes: Optional[list[WithResponsePatchResponse_rfi_permittedActions_updateRfi_permittedAttributes]] = None
    # A list of statuses the user is permitted to transition an RFI to.
    permitted_statuses: Optional[WithResponsePatchResponse_rfi_permittedActions_updateRfi_permittedStatuses] = None
    # ``true``: The user is allowed to fill in custom attributes when creating the RFI.``false`` (default): The user is not allowed to fill in custom attributes when creating the RFI.
    use_custom_attributes: Optional[bool] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WithResponsePatchResponse_rfi_permittedActions_updateRfi:
        """
        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: WithResponsePatchResponse_rfi_permittedActions_updateRfi
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WithResponsePatchResponse_rfi_permittedActions_updateRfi()
    
    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_response_patch_response_rfi_permitted_actions_update_rfi_permitted_attributes import WithResponsePatchResponse_rfi_permittedActions_updateRfi_permittedAttributes
        from .with_response_patch_response_rfi_permitted_actions_update_rfi_permitted_statuses import WithResponsePatchResponse_rfi_permittedActions_updateRfi_permittedStatuses

        from .with_response_patch_response_rfi_permitted_actions_update_rfi_permitted_attributes import WithResponsePatchResponse_rfi_permittedActions_updateRfi_permittedAttributes
        from .with_response_patch_response_rfi_permitted_actions_update_rfi_permitted_statuses import WithResponsePatchResponse_rfi_permittedActions_updateRfi_permittedStatuses

        fields: dict[str, Callable[[Any], None]] = {
            "permittedAttributes": lambda n : setattr(self, 'permitted_attributes', n.get_collection_of_object_values(WithResponsePatchResponse_rfi_permittedActions_updateRfi_permittedAttributes)),
            "permittedStatuses": lambda n : setattr(self, 'permitted_statuses', n.get_object_value(WithResponsePatchResponse_rfi_permittedActions_updateRfi_permittedStatuses)),
            "useCustomAttributes": lambda n : setattr(self, 'use_custom_attributes', n.get_bool_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_collection_of_object_values("permittedAttributes", self.permitted_attributes)
        writer.write_object_value("permittedStatuses", self.permitted_statuses)
        writer.write_bool_value("useCustomAttributes", self.use_custom_attributes)
    

