import { z } from 'zod';
import { CheckboxFilterInputSchema } from './checkbox-filter-input.schema';
import { DateRangeFilterInputSchema } from './date-range-filter-input.schema';
import { TextFilterInputSchema } from './text-filter-input.schema';
import { NumberRangeFilterInputSchema } from './number-range-filter-input.schema';

/**
 * A union schema representing all possible filter input types in the system.
 * This schema allows for type discrimination based on the `type` property.
 *
 * Supported filter input types:
 * - TextFilterInput: Simple text input fields
 * - CheckboxFilterInput: Multiple-choice checkbox selections
 * - DateRangeFilterInput: Date range selectors for time-based filtering
 */
export const FilterInputSchema = z.union([
  TextFilterInputSchema,
  CheckboxFilterInputSchema,
  DateRangeFilterInputSchema,
  NumberRangeFilterInputSchema,
]);

export type FilterInput = z.infer<typeof FilterInputSchema>;
