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 .uploads_post_request_body_files_storage_type import UploadsPostRequestBody_files_storageType

@dataclass
class UploadsPostRequestBody_files(Parsable):
    # The name of the file.Currently the Sheets tool only supports PDF files.To create a storage URN, call `POST storage </en/docs/acc/v1/reference/http/sheets-storage-POST/>`_.Max length: 255
    name: Optional[str] = None
    # The storage type of the file. Will always be ``OSS``.
    storage_type: Optional[UploadsPostRequestBody_files_storageType] = None
    # The storage URN of the file.
    storage_urn: Optional[str] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> UploadsPostRequestBody_files:
        """
        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: UploadsPostRequestBody_files
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return UploadsPostRequestBody_files()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .uploads_post_request_body_files_storage_type import UploadsPostRequestBody_files_storageType

        from .uploads_post_request_body_files_storage_type import UploadsPostRequestBody_files_storageType

        fields: dict[str, Callable[[Any], None]] = {
            "name": lambda n : setattr(self, 'name', n.get_str_value()),
            "storageType": lambda n : setattr(self, 'storage_type', n.get_enum_value(UploadsPostRequestBody_files_storageType)),
            "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_str_value("name", self.name)
        writer.write_enum_value("storageType", self.storage_type)
        writer.write_str_value("storageUrn", self.storage_urn)
    

