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_host_file_publish_status import LinkedFilesGetResponse_hostFile_publishStatus

@dataclass
class LinkedFilesGetResponse_hostFile(Parsable):
    """
    Metadata about the host model (the main Revit model that contains linked files). This object is only returned in the response when ``includeHost`` is set to ``true``.
    """
    # The URN of the host model.
    item_id: Optional[str] = None
    # The name of the host model.
    model_name: Optional[str] = None
    # Indicates whether the host model has been published. Possible values:``published`` – The model has been published.``notPublished`` – The model has not been published.
    publish_status: Optional[LinkedFilesGetResponse_hostFile_publishStatus] = None
    # A temporary URL used to download the host model. Signed URLs are valid for 1 hour.
    signed_url: Optional[str] = None
    # The file size of the host model in bytes.
    size: Optional[int] = None
    # The version ID of the host model.
    version_id: Optional[str] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> LinkedFilesGetResponse_hostFile:
        """
        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_hostFile
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return LinkedFilesGetResponse_hostFile()
    
    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_host_file_publish_status import LinkedFilesGetResponse_hostFile_publishStatus

        from .linked_files_get_response_host_file_publish_status import LinkedFilesGetResponse_hostFile_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_hostFile_publishStatus)),
            "signedUrl": lambda n : setattr(self, 'signed_url', n.get_str_value()),
            "size": lambda n : setattr(self, 'size', n.get_int_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_int_value("size", self.size)
        writer.write_str_value("versionId", self.version_id)
    

