"""Base schemas for the application.""" from marshmallow import validate from abacus_common_logic.constants.constants import ( DEFAULT_MAX_PAGE_LIMIT, DEFAULT_PAGE_LIMIT, DEFAULT_PAGE_OFFSET, ) from abacus_common_logic.marshalling.custom_fields import ma class PaginationSchema(ma.Schema): """Schema for Pagination. This schema defines the structure and validation rules for the Pagination. It specifies the required fields and their data types. Attributes: limit (int): The limit of the pagination. offset (int): The offset of the pagination. """ limit = ma.Integer( load_default=DEFAULT_PAGE_LIMIT, required=False, validate=[validate.Range(min=1, max=DEFAULT_MAX_PAGE_LIMIT)], ) offset = ma.Integer( load_default=DEFAULT_PAGE_OFFSET, required=False, validate=[validate.Range(min=0)], )