"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toolFindExploresOutputSchema = exports.findExploresRankingMetadataSchema = exports.toolFindExploresArgsSchemaTransformed = exports.toolFindExploresArgsSchemaV3 = exports.toolFindExploresArgsSchemaV2 = exports.toolFindExploresArgsSchemaV1 = exports.TOOL_FIND_EXPLORES_DESCRIPTION = void 0;
const zod_1 = require("zod");
const outputMetadata_1 = require("../outputMetadata");
const toolSchemaBuilder_1 = require("../toolSchemaBuilder");
exports.TOOL_FIND_EXPLORES_DESCRIPTION = `Tool: findExplores

Purpose:
Returns an explore with all its fields, joined tables, AI hints and descriptions. When multiple explores match your search, also returns alternative explores and top 50 matching fields across ALL explores.
IMPORTANT: Each explore may include fields from multiple joined tables. Check the "joinedTables" elements to see which tables are included in the explore.

Parameters:
- searchQuery: Full user query for finding relevant explores

Output:
- Selected explore with all fields and metadata (including fields from joined tables)
- Alternative explores (if multiple matches) with searchRank scores
- Top matching fields with their explore names and searchRank scores
`;
exports.toolFindExploresArgsSchemaV1 = (0, toolSchemaBuilder_1.createToolSchema)()
    .extend({
    exploreName: zod_1.z
        .string()
        .nullable()
        .describe('Name of the explore that you have access to'),
})
    .withPagination()
    .build();
exports.toolFindExploresArgsSchemaV2 = (0, toolSchemaBuilder_1.createToolSchema)()
    .extend({
    exploreName: zod_1.z
        .string()
        .describe('Name of the explore that you have access to'),
})
    .build();
exports.toolFindExploresArgsSchemaV3 = (0, toolSchemaBuilder_1.createToolSchema)()
    .extend({
    // TODO: check if we need to add exploreName back in for backward compatibility
    searchQuery: zod_1.z
        .string()
        .describe('The full user query or search terms to help find the most relevant explore. Use the complete user request for better search results.'),
})
    .build();
exports.toolFindExploresArgsSchemaTransformed = exports.toolFindExploresArgsSchemaV3;
exports.findExploresRankingMetadataSchema = zod_1.z.object({
    searchQuery: zod_1.z.string(),
    exploreSearchResults: zod_1.z
        .array(zod_1.z.object({
        name: zod_1.z.string(),
        label: zod_1.z.string(),
        searchRank: zod_1.z.number().nullable().optional(),
        joinedTables: zod_1.z.array(zod_1.z.string()).nullable().optional(),
    }))
        .optional(),
    topMatchingFields: 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(),
        verifiedChartUsage: zod_1.z.number().nullable().optional(),
    }))
        .optional(),
});
exports.toolFindExploresOutputSchema = zod_1.z.object({
    result: zod_1.z.string(),
    metadata: outputMetadata_1.baseOutputMetadataSchema.extend({
        ranking: exports.findExploresRankingMetadataSchema.optional(),
    }),
});
//# sourceMappingURL=toolFindExploresArgs.js.map