import jdatetime
from rest_framework.pagination import PageNumberPagination


class CustomPagination(PageNumberPagination):
    page_size = 10


def convert_to_miladi(year=None, month=None, day=None):
    date = jdatetime.datetime(year, month, day).togregorian()
    return date


def build_query(fields, value):
    from django.db.models import Q
    query = Q()
    for field in fields:
        query |= Q(**{f"{field}__icontains": value})
    return query
