/**
 * JSON Schema definition for the `read` tool.
 *
 * The read tool accepts a list of files and returns their content (or a
 * transformed view of it) in one batched response.
 */
export const READ_TOOL_SCHEMA = {
    type: 'object',
    properties: {
        files: {
            type: 'array',
            description: 'Files to read. Processed as a batch in one call.',
            items: {
                type: 'object',
                properties: {
                    path: {
                        type: 'string',
                        description: 'Relative or absolute path to the file.',
                    },
                    extract: {
                        type: 'string',
                        enum: ['content', 'outline', 'symbols', 'ast', 'lines'],
                        description: 'Extraction mode. Overrides the global extract for this file.'
                            + ' content: full text; outline: signatures without bodies;'
                            + ' symbols: exported names only; lines: specific line range;'
                            + ' ast: structural outline via tree-sitter (falls back to regex if grammar unavailable).',
                    },
                    range: {
                        type: 'object',
                        description: 'Line range to read (1-based, inclusive). Used with extract=lines.',
                        properties: {
                            start: { type: 'integer', minimum: 1 },
                            end: { type: 'integer', minimum: 1 },
                        },
                        required: ['start', 'end'],
                    },
                    force: {
                        type: 'boolean',
                        description: 'Bypass cache and re-read the file from disk.',
                    },
                    pages: {
                        type: 'string',
                        description: 'Page range for PDF files (e.g. \'1-5\', \'3\', \'10-20\'). Max 20 pages per request.',
                    },
                    image_mode: {
                        type: 'string',
                        enum: ['default', 'unoptimized', 'metadata-only', 'thumbnail-only'],
                        description: 'Image handling mode. default: resize to 1568px max edge (token-efficient).'
                            + ' unoptimized: full resolution. metadata-only: dimensions/format/size only, no image data.'
                            + ' thumbnail-only: aggressive 256px resize for previews.',
                    },
                },
                required: ['path'],
            },
            minItems: 1,
            maxItems: 50,
        },
        extract: {
            type: 'string',
            enum: ['content', 'outline', 'symbols', 'ast', 'lines'],
            description: 'Global extraction mode applied to all files unless overridden per-file.'
                + ' Defaults to content.',
        },
        output: {
            type: 'object',
            description: 'Output formatting options.',
            properties: {
                format: {
                    type: 'string',
                    enum: ['count_only', 'minimal', 'standard', 'verbose'],
                    description: 'count_only: file count + totals; minimal: paths + line counts;'
                        + ' standard: full content with line numbers (default);'
                        + ' verbose: full content + metadata.',
                },
                include_line_numbers: {
                    type: 'boolean',
                    description: 'Include line numbers in content output. Default true.',
                },
                max_per_item: {
                    type: 'integer',
                    minimum: 1,
                    description: 'Maximum lines to return per file.',
                },
                max_tokens: {
                    type: 'integer',
                    minimum: 1,
                    description: 'Hard token cap across the entire response.',
                },
            },
        },
        token_budget: {
            type: 'integer',
            minimum: 1,
            description: 'Token budget for paginated reads. When set, results are binned into'
                + ' pages that fit within the budget.',
        },
        page: {
            type: 'integer',
            minimum: 1,
            description: 'Page number to return when using token_budget pagination. Default 1.',
        },
        image_mode: {
            type: 'string',
            enum: ['default', 'unoptimized', 'metadata-only', 'thumbnail-only'],
            description: 'Global image handling mode. Per-file image_mode overrides this. Default: default.',
        },
        max_image_size: {
            type: 'integer',
            minimum: 1,
            description: 'Maximum image file size in bytes. Images exceeding this return metadata only.'
                + ' Default: 5242880 (5MB).',
        },
    },
    required: ['files'],
};
