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
from uuid import UUID

if TYPE_CHECKING:
    from .attachments_post_request_body_attachments_attachment_type import AttachmentsPostRequestBody_attachments_attachmentType

@dataclass
class AttachmentsPostRequestBody_attachments(Parsable):
    # The unique identifier for the attachment, set by the client when creating the attachment reference. This can be any unique GUID, but it is recommended to use the OSS storage GUID. For more information, see the `Upload Issue Attachment </en/docs/acc/v1/tutorials/issues/upload-issue-attachments/>`_ tutorial.
    attachment_id: Optional[UUID] = None
    # The type of attachment to create. Set to ``issue-attachment``. Will always be: ``issue-attachment``
    attachment_type: Optional[AttachmentsPostRequestBody_attachments_attachmentType] = None
    # The human-readable display name for the attachment, including the file extension (for example, ``.pdf``, ``.jpg``, ``.dwg``). This name appears in the ACC web UI and is used when downloading the file from the issue.
    display_name: Optional[str] = None
    # The unique filename of the attachment, typically formatted as {attachmentId}.{fileExtension}.This value must exactly match the name of the file stored in Autodesk Docs (OSS) that you uploaded via the OSS process.For more information, see the `Upload Issue Attachment </en/docs/acc/v1/tutorials/issues/upload-issue-attachments/>`_ tutorial.
    file_name: Optional[str] = None
    # The Object Storage Service (OSS) URN that uniquely identifies where the file is stored in Autodesk's cloud infrastructure. You obtain this value after uploading the file to OSS (see the `Upload Issue Attachment </en/docs/acc/v1/tutorials/issues/upload-issue-attachments/>`_ tutorial) or by retrieving it from an existing attachment (see the `Downloading Issue Attachments </en/docs/acc/v1/tutorials/issues/download-issue-attachments/>`_ tutorial).
    storage_urn: Optional[str] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> AttachmentsPostRequestBody_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: AttachmentsPostRequestBody_attachments
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return AttachmentsPostRequestBody_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 .attachments_post_request_body_attachments_attachment_type import AttachmentsPostRequestBody_attachments_attachmentType

        from .attachments_post_request_body_attachments_attachment_type import AttachmentsPostRequestBody_attachments_attachmentType

        fields: dict[str, Callable[[Any], None]] = {
            "attachmentId": lambda n : setattr(self, 'attachment_id', n.get_uuid_value()),
            "attachmentType": lambda n : setattr(self, 'attachment_type', n.get_enum_value(AttachmentsPostRequestBody_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_uuid_value("attachmentId", self.attachment_id)
        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)
    

