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_attachment_type import WithResponsePatchRequestBody_attachments_attachmentType

@dataclass
class WithResponsePatchRequestBody_attachments(Parsable):
    # The type of the attachment. Will always be: ``rfiResponse``
    attachment_type: Optional[WithResponsePatchRequestBody_attachments_attachmentType] = None
    # The user-facing name to show in the UI.
    display_name: Optional[str] = None
    # The internal file name.
    file_name: Optional[str] = None
    # The storage URN of the uploaded file.Use this value to generate a signed URL and download the file via the Data Management API.For more details, see the `Submit RFI Response </en/docs/acc/v1/tutorials/create-rfi-response/>`_ tutorial.
    storage_urn: Optional[str] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> WithResponsePatchRequestBody_attachments:
        """
        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_attachments
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return WithResponsePatchRequestBody_attachments()
    
    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_attachment_type import WithResponsePatchRequestBody_attachments_attachmentType

        from .with_response_patch_request_body_attachments_attachment_type import WithResponsePatchRequestBody_attachments_attachmentType

        fields: dict[str, Callable[[Any], None]] = {
            "attachmentType": lambda n : setattr(self, 'attachment_type', n.get_enum_value(WithResponsePatchRequestBody_attachments_attachmentType)),
            "displayName": lambda n : setattr(self, 'display_name', n.get_str_value()),
            "fileName": lambda n : setattr(self, 'file_name', n.get_str_value()),
            "storageUrn": lambda n : setattr(self, 'storage_urn', 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_enum_value("attachmentType", self.attachment_type)
        writer.write_str_value("displayName", self.display_name)
        writer.write_str_value("fileName", self.file_name)
        writer.write_str_value("storageUrn", self.storage_urn)
    

