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

/**
 * Schema for text-based filter inputs that allow free-form text entry.
 * Extends BaseFilterInputSchema with text input specific properties.
 *
 * @property type - Must be InputType.Text
 * @property placeholder - Optional hint text to display when the input is empty
 * @property defaultValue - Optional initial value to populate the input with
 * @property value - Current value of the text input
 */
export const TextFilterInputSchema = BaseFilterInputSchema.extend({
  type: z
    .literal(InputType.Text)
    .describe('Specifies this as a text input type. Must be InputType.Text.'),
  placeholder: z
    .string()
    .optional()
    .describe(
      'Hint text displayed when the input is empty to guide users on what to enter.',
    ),
  defaultValue: z
    .string()
    .optional()
    .describe(
      'Initial value to populate the text field with when first rendered or reset.',
    ),
  value: z
    .string()
    .optional()
    .describe(
      'Current value of the text input field, reflecting what the user has entered.',
    ),
}).describe('TextFilterInput');

export type TextFilterInput = z.infer<typeof TextFilterInputSchema>;
