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_request_body_attachments import WithResponsePatchRequestBody_attachments
    from .with_response_patch_request_body_on_behalf import WithResponsePatchRequestBody_onBehalf
    from .with_response_patch_request_body_status import WithResponsePatchRequestBody_status

@dataclass
class WithResponsePatchRequestBody(Parsable):
    # A list of files to attach to the RFI response.
    attachments: Optional[list[WithResponsePatchRequestBody_attachments]] = None
    # The Autodesk ID of the reviewer for whom the response is being submitted.To find user details, call `GET users </en/docs/acc/v1/reference/http/admin-projectsprojectId-users-GET/>`_.'
    on_behalf: Optional[WithResponsePatchRequestBody_onBehalf] = None
    # The status of the response.To determine which status values the user is allowed to submit, call `GET users/me </en/docs/acc/v1/reference/http/rfis-users-me-GET/>`_.Possible values: ``answered``, ``rejected``.
    status: Optional[WithResponsePatchRequestBody_status] = None
    # The body text of the RFI response. This field supports plain text only.
    text: Optional[str] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WithResponsePatchRequestBody:
        """
        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: WithResponsePatchRequestBody
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WithResponsePatchRequestBody()
    
    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_request_body_attachments import WithResponsePatchRequestBody_attachments
        from .with_response_patch_request_body_on_behalf import WithResponsePatchRequestBody_onBehalf
        from .with_response_patch_request_body_status import WithResponsePatchRequestBody_status

        from .with_response_patch_request_body_attachments import WithResponsePatchRequestBody_attachments
        from .with_response_patch_request_body_on_behalf import WithResponsePatchRequestBody_onBehalf
        from .with_response_patch_request_body_status import WithResponsePatchRequestBody_status

        fields: dict[str, Callable[[Any], None]] = {
            "attachments": lambda n : setattr(self, 'attachments', n.get_collection_of_object_values(WithResponsePatchRequestBody_attachments)),
            "onBehalf": lambda n : setattr(self, 'on_behalf', n.get_object_value(WithResponsePatchRequestBody_onBehalf)),
            "status": lambda n : setattr(self, 'status', n.get_enum_value(WithResponsePatchRequestBody_status)),
            "text": lambda n : setattr(self, 'text', n.get_str_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("attachments", self.attachments)
        writer.write_object_value("onBehalf", self.on_behalf)
        writer.write_enum_value("status", self.status)
        writer.write_str_value("text", self.text)
    

