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

export const searchParams = {
  page: parseAsInteger.withDefault(1),
  perPage: parseAsInteger.withDefault(10),
  search: parseAsString,
  name: parseAsString,
  user_name: parseAsString,
  user: parseAsString,
  gender: parseAsString,
  category: parseAsString,
  status: parseAsString,
  approval_status: parseAsString,
  type: parseAsString,
  training_type: parseAsString,
  year: parseAsString,
  company: parseAsString,
  department: parseAsString,
  position: parseAsString,
  role: parseAsString,
  module: parseAsString,
  action: parseAsString,
  pin: parseAsString,
  dateFrom: parseAsString,
  dateTo: parseAsString,
  sort: parseAsString
  // advanced filter
  // filters: getFiltersStateParser().withDefault([]),
  // joinOperator: parseAsStringEnum(['and', 'or']).withDefault('and')
};

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