import { z } from 'zod';
import { BaseFilterInputSchema } from './base-filter-input.schema';
import { InputType } from '../../types';

/**
 * Schema for date range inputs that allow filtering by a time period.
 * Extends BaseFilterInputSchema with date range specific properties.
 *
 * @property type - Must be InputType.DateRange
 * @property start - Optional ISO string representing the start date of the range
 * @property stop - Optional ISO string representing the end date of the range
 */
export const DateRangeFilterInputSchema = BaseFilterInputSchema.extend({
  type: z
    .literal(InputType.DateRange)
    .describe(
      'Specifies this as a date range input type. Must be InputType.DateRange.',
    ),
  start: z
    .string()
    .optional()
    .describe(
      'ISO date string representing the beginning of the date range. Optional if only an end date is needed.',
    ),
  minStart: z
    .string()
    .optional()
    .describe(
      'ISO date string representing the minimum start date of the range. Optional if only an end date is needed.',
    ),
  stop: z
    .string()
    .optional()
    .describe(
      'ISO date string representing the end of the date range. Optional if only a start date is needed.',
    ),
  maxStop: z
    .string()
    .optional()
    .describe(
      'ISO date string representing the maximum end date of the range. Optional if only a start date is needed.',
    ),
}).describe('DateRangeFilterInput');

export type DateRangeFilterInput = z.infer<typeof DateRangeFilterInputSchema>;
