import { createTypedValidator } from '@takeshape/json-schema';
export const schema = {
    type: 'object',
    properties: {
        text: {
            type: 'string',
            description: 'The text to search for in the documents.'
        },
        size: {
            type: 'integer',
            maximum: 50,
            description: 'The maximum number of results to return.'
        },
        from: {
            type: 'integer',
            description: 'A number of results to skip before starting to collect the result set. This is useful for pagination.'
        },
        sort: {
            type: 'array',
            description: 'The fields to sort the results by.',
            items: {
                type: 'object',
                properties: {
                    field: {
                        type: 'string'
                    },
                    order: {
                        type: 'string',
                        enum: ['asc', 'desc']
                    }
                },
                required: ['field', 'order'],
                additionalProperties: false
            }
        },
        threshold: {
            type: 'number',
            description: 'The minimum score a document must have to be returned.'
        }
    },
    required: ['text'],
    additionalProperties: false
};
export const validate = createTypedValidator(schema, {
    useDefaults: true
});
