import {
  createSearchParamsCache,
  createSerializer,
  parseAsInteger,
  parseAsString
} from 'nuqs/server';

export const searchParams = {
  page: parseAsInteger.withDefault(1),
  perPage: parseAsInteger.withDefault(10),
  name: parseAsString,
  gender: parseAsString,
  category: parseAsString,
  customerType: parseAsString,
  customerStatus: parseAsString,
  customer: parseAsString,
  enquiry: parseAsString,
  branch: parseAsString,
  productType: parseAsString,
  priority: parseAsString,
  salesman: parseAsString,
  dateFrom: parseAsString,
  dateTo: parseAsString,
  quotationType: parseAsString,
  hot: parseAsString,
  view: parseAsString,
  status: parseAsString,
  entityType: parseAsString,
  assetType: parseAsString,
  role: parseAsString,
  projectPartyRole: parseAsString,
  sort: parseAsString
  // advanced filter
  // filters: getFiltersStateParser().withDefault([]),
  // joinOperator: parseAsStringEnum(['and', 'or']).withDefault('and')
};

export const searchParamsCache = createSearchParamsCache(searchParams);
export const serialize = createSerializer(searchParams);
