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 .photos_filter_post_request_body_filter import PhotosFilterPostRequestBody_filter

@dataclass
class PhotosFilterPostRequestBody(Parsable):
    # The cursorState property
    cursor_state: Optional[str] = None
    # The filter property
    filter: Optional[list[PhotosFilterPostRequestBody_filter]] = None
    # The include property
    include: Optional[list[str]] = None
    # The limit property
    limit: Optional[int] = None
    # The sort property
    sort: Optional[list[str]] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> PhotosFilterPostRequestBody:
        """
        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: PhotosFilterPostRequestBody
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return PhotosFilterPostRequestBody()
    
    def get_field_deserializers(self,) -> dict[str, Callable[[ParseNode], None]]:
        """
        The deserialization information for the current model
        Returns: dict[str, Callable[[ParseNode], None]]
        """
        from .photos_filter_post_request_body_filter import PhotosFilterPostRequestBody_filter

        from .photos_filter_post_request_body_filter import PhotosFilterPostRequestBody_filter

        fields: dict[str, Callable[[Any], None]] = {
            "cursorState": lambda n : setattr(self, 'cursor_state', n.get_str_value()),
            "filter": lambda n : setattr(self, 'filter', n.get_collection_of_object_values(PhotosFilterPostRequestBody_filter)),
            "include": lambda n : setattr(self, 'include', n.get_collection_of_primitive_values(str)),
            "limit": lambda n : setattr(self, 'limit', n.get_int_value()),
            "sort": lambda n : setattr(self, 'sort', n.get_collection_of_primitive_values(str)),
        }
        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("cursorState", self.cursor_state)
        writer.write_collection_of_object_values("filter", self.filter)
        writer.write_collection_of_primitive_values("include", self.include)
        writer.write_int_value("limit", self.limit)
        writer.write_collection_of_primitive_values("sort", self.sort)
    

