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 .content_views_get_response_results_view_model_view import ContentViewsGetResponse_results_view_ModelView
    from .content_views_get_response_results_view_sheet_view import ContentViewsGetResponse_results_view_SheetView

@dataclass
class ContentViewsGetResponse_results_view(Parsable):
    """
    The content view.
    """
    # The 3D model view.
    model_view: Optional[ContentViewsGetResponse_results_view_ModelView] = None
    # The 2D sheet view.
    sheet_view: Optional[ContentViewsGetResponse_results_view_SheetView] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> ContentViewsGetResponse_results_view:
        """
        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: ContentViewsGetResponse_results_view
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return ContentViewsGetResponse_results_view()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .content_views_get_response_results_view_model_view import ContentViewsGetResponse_results_view_ModelView
        from .content_views_get_response_results_view_sheet_view import ContentViewsGetResponse_results_view_SheetView

        from .content_views_get_response_results_view_model_view import ContentViewsGetResponse_results_view_ModelView
        from .content_views_get_response_results_view_sheet_view import ContentViewsGetResponse_results_view_SheetView

        fields: dict[str, Callable[[Any], None]] = {
            "Model View": lambda n : setattr(self, 'model_view', n.get_object_value(ContentViewsGetResponse_results_view_ModelView)),
            "Sheet View": lambda n : setattr(self, 'sheet_view', n.get_object_value(ContentViewsGetResponse_results_view_SheetView)),
        }
        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_object_value("Model View", self.model_view)
        writer.write_object_value("Sheet View", self.sheet_view)
    

