import * as z from 'zod'

const resourceTabEnum = z.enum(['all', 'patient', 'encounter', 'observation'])

export const tabSwitcher = resourceTabEnum.default('all').catch('all')
export const querySchema = z.object({
  q: z.string().min(3).optional().catch(''),
  resource_type: tabSwitcher,
  date_from: z.string().optional().catch(''),
  date_to: z.string().optional().catch(''),
  page: z.coerce.number().int().min(1).default(1).catch(1),
  limit: z.coerce.number().int().min(1).max(20).default(10).catch(10),
})

export const defaultQuery = {
  q: '',
  status: '',
  resource_type: 'all',
  date_from: '',
  date_to: '',
  page: 1,
  limit: 10,
}
