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 AssetsGetResponse_pagination(Parsable):
    # An opaque cursor token that identifies where the next page of paginated results should start. It'sreturned in each paginated response so that it can be supplied in the next request to continue paginatedresults. If a paginated response contains no ``cursorState`` value, then there are no further pages toreturn.Omit this field to initiate a paginated request or to restart pagination.
    cursor_state: Optional[str] = None
    # The maximum number of objects that can be returned in a page. A request might return fewer objects thanthe limit if the Assets service runs out of specified objects to return - at the end of a set of pagedresults, for example. The maximum limit is ``200``; the default limit is ``25``.
    limit: Optional[int] = None
    # A URL that requests the next page for this query.
    next_url: Optional[str] = None
    
    @staticmethod
    def create_from_discriminator_value(parse_node: ParseNode) -> AssetsGetResponse_pagination:
        """
        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: AssetsGetResponse_pagination
        """
        if parse_node is None:
            raise TypeError("parse_node cannot be null.")
        return AssetsGetResponse_pagination()
    
    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]] = {
            "cursorState": lambda n : setattr(self, 'cursor_state', n.get_str_value()),
            "limit": lambda n : setattr(self, 'limit', n.get_int_value()),
            "nextUrl": lambda n : setattr(self, 'next_url', 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("cursorState", self.cursor_state)
        writer.write_int_value("limit", self.limit)
        writer.write_str_value("nextUrl", self.next_url)
    

