"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toolFindFieldsOutputSchema = exports.findFieldsRankingMetadataSchema = exports.toolFindFieldsArgsSchemaTransformed = exports.toolFindFieldsArgsSchema = exports.TOOL_FIND_FIELDS_DESCRIPTION = void 0;
const zod_1 = require("zod");
const outputMetadata_1 = require("../outputMetadata");
const toolSchemaBuilder_1 = require("../toolSchemaBuilder");
exports.TOOL_FIND_FIELDS_DESCRIPTION = `Tool: "findFields"

Purpose:
Finds the most relevant Fields (Metrics & Dimensions) within Explores, returning detailed info about each.

Usage tips:
- Use "findExplores" first to discover available Explores and their field labels.
- Use full field labels in search terms (e.g. "Total Revenue", "Order Date").
- Pass all needed fields in one request.
- Fields are sorted by relevance, with a maximum score of 1 and a minimum of 0, so the top results are the most relevant.
- If results aren't relevant, retry with clearer or more specific terms.
- Results are paginated — use the next page token to get more results if needed.
`;
exports.toolFindFieldsArgsSchema = (0, toolSchemaBuilder_1.createToolSchema)({
    description: exports.TOOL_FIND_FIELDS_DESCRIPTION,
})
    .extend({
    table: zod_1.z.string().describe('The table to search in.'),
    fieldSearchQueries: zod_1.z.array(zod_1.z.object({
        label: zod_1.z.string().describe('Full field label'),
    })),
})
    .withPagination()
    .build();
exports.toolFindFieldsArgsSchemaTransformed = exports.toolFindFieldsArgsSchema;
exports.findFieldsRankingMetadataSchema = zod_1.z.object({
    searchQueries: zod_1.z.array(zod_1.z.object({
        label: zod_1.z.string(),
        results: zod_1.z.array(zod_1.z.object({
            name: zod_1.z.string(),
            label: zod_1.z.string(),
            tableName: zod_1.z.string(),
            fieldType: zod_1.z.string(),
            searchRank: zod_1.z.number().nullable().optional(),
            chartUsage: zod_1.z.number().nullable().optional(),
        })),
        pagination: zod_1.z
            .object({
            page: zod_1.z.number(),
            pageSize: zod_1.z.number(),
            totalResults: zod_1.z.number(),
            totalPageCount: zod_1.z.number(),
        })
            .optional(),
    })),
});
exports.toolFindFieldsOutputSchema = zod_1.z.object({
    result: zod_1.z.string(),
    metadata: outputMetadata_1.baseOutputMetadataSchema.extend({
        ranking: exports.findFieldsRankingMetadataSchema.optional(),
    }),
});
//# sourceMappingURL=toolFindFieldsArgs.js.map