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 .linked_files_get_response_linked_files_results_publish_status import LinkedFilesGetResponse_linkedFiles_results_publishStatus

@dataclass
class LinkedFilesGetResponse_linkedFiles_results(Parsable):
    # The URN of the linked model.
    item_id: Optional[str] = None
    # The name of the linked model, as referenced within the host model.
    model_name: Optional[str] = None
    # Indicates whether the linked model has been published. Possible values:``published`` – The model has been published.``notPublished`` – The model has not been published.
    publish_status: Optional[LinkedFilesGetResponse_linkedFiles_results_publishStatus] = None
    # A temporary URL used to download the linked model. Signed URLs are valid for 1 hour.
    signed_url: Optional[str] = None
    # The version ID of the linked model. If the model is unpublished, this field is omitted from the response.
    version_id: Optional[str] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> LinkedFilesGetResponse_linkedFiles_results:
        """
        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: LinkedFilesGetResponse_linkedFiles_results
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return LinkedFilesGetResponse_linkedFiles_results()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .linked_files_get_response_linked_files_results_publish_status import LinkedFilesGetResponse_linkedFiles_results_publishStatus

        from .linked_files_get_response_linked_files_results_publish_status import LinkedFilesGetResponse_linkedFiles_results_publishStatus

        fields: dict[str, Callable[[Any], None]] = {
            "itemId": lambda n : setattr(self, 'item_id', n.get_str_value()),
            "modelName": lambda n : setattr(self, 'model_name', n.get_str_value()),
            "publishStatus": lambda n : setattr(self, 'publish_status', n.get_enum_value(LinkedFilesGetResponse_linkedFiles_results_publishStatus)),
            "signedUrl": lambda n : setattr(self, 'signed_url', n.get_str_value()),
            "versionId": lambda n : setattr(self, 'version_id', 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("itemId", self.item_id)
        writer.write_str_value("modelName", self.model_name)
        writer.write_enum_value("publishStatus", self.publish_status)
        writer.write_str_value("signedUrl", self.signed_url)
        writer.write_str_value("versionId", self.version_id)
    

