"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toolRunContentQueryOutputSchema = exports.toolRunContentQueryArgsSchema = exports.TOOL_RUN_CONTENT_QUERY_DESCRIPTION = void 0;
const zod_1 = require("zod");
const outputMetadata_1 = require("../outputMetadata");
const toolSchemaBuilder_1 = require("../toolSchemaBuilder");
const toolCreateContentArgs_1 = require("./toolCreateContentArgs");
exports.TOOL_RUN_CONTENT_QUERY_DESCRIPTION = `Run a chart-as-code metric query or saved chart content and return the rows it produces as CSV.

Use this to verify generated or edited chart content before presenting it as complete.

Input modes:
- metricQuery: run an unsaved chart-as-code metricQuery with a tableName.
- chart: run a saved chart by chartSlug.
- dashboardChart: run a saved chart by chartSlug in a dashboardSlug context, applying dashboard filters.`;
exports.toolRunContentQueryArgsSchema = (0, toolSchemaBuilder_1.createToolSchema)()
    .extend({
    source: zod_1.z.discriminatedUnion('type', [
        zod_1.z.object({
            type: zod_1.z.literal('metricQuery'),
            tableName: zod_1.z
                .string()
                .describe('The chart-as-code tableName/explore name.'),
            metricQuery: toolCreateContentArgs_1.toolChartAsCodeMetricQuerySchema,
            parameters: zod_1.z
                .unknown()
                .nullable()
                .describe('Optional chart parameter values, or null.'),
        }),
        zod_1.z.object({
            type: zod_1.z.literal('chart'),
            chartSlug: zod_1.z.string().describe('Slug of the saved chart.'),
            limit: zod_1.z
                .number()
                .nullable()
                .describe('Optional row limit override.'),
        }),
        zod_1.z.object({
            type: zod_1.z.literal('dashboardChart'),
            chartSlug: zod_1.z.string().describe('Slug of the saved chart.'),
            dashboardSlug: zod_1.z
                .string()
                .describe('Slug of the dashboard containing the chart.'),
            limit: zod_1.z
                .number()
                .nullable()
                .describe('Optional row limit override.'),
        }),
    ]),
})
    .build();
exports.toolRunContentQueryOutputSchema = zod_1.z.object({
    result: zod_1.z.string(),
    metadata: outputMetadata_1.baseOutputMetadataSchema,
});
//# sourceMappingURL=toolRunContentQueryArgs.js.map