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

@dataclass
class ManifestGetResponse_stats(Parsable):
    # The number of design elements added between the compared model versions.
    added_objects: Optional[int] = None
    # The number of design elements which have update property values or altered geometry.
    changed_objects: Optional[int] = None
    # The compressed file size in bytes of the index. This file can be downloaded via the diff properties endpoint.
    content_length: Optional[int] = None
    # The number of design elements removed between the compared model versions.
    removed_objects: Optional[int] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> ManifestGetResponse_stats:
        """
        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: ManifestGetResponse_stats
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return ManifestGetResponse_stats()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        fields: dict[str, Callable[[Any], None]] = {
            "addedObjects": lambda n : setattr(self, 'added_objects', n.get_int_value()),
            "changedObjects": lambda n : setattr(self, 'changed_objects', n.get_int_value()),
            "contentLength": lambda n : setattr(self, 'content_length', n.get_int_value()),
            "removedObjects": lambda n : setattr(self, 'removed_objects', n.get_int_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_int_value("addedObjects", self.added_objects)
        writer.write_int_value("changedObjects", self.changed_objects)
        writer.write_int_value("contentLength", self.content_length)
        writer.write_int_value("removedObjects", self.removed_objects)
    

