"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toolRunMetricQueryOutputSchema = exports.toolRunMetricQueryArgsSchemaTransformed = exports.toolRunMetricQueryArgsSchema = exports.TOOL_RUN_METRIC_QUERY_DESCRIPTION = void 0;
const zod_1 = require("zod");
const customMetrics_1 = require("../customMetrics");
const filters_1 = require("../filters");
const outputMetadata_1 = require("../outputMetadata");
const tableCalcs_1 = require("../tableCalcs/tableCalcs");
const toolSchemaBuilder_1 = require("../toolSchemaBuilder");
const visualizations_1 = require("../visualizations");
exports.TOOL_RUN_METRIC_QUERY_DESCRIPTION = `Tool: runMetricQuery

Purpose:
Run a metric query and get the results as CSV data. This is useful for data analysis and export.

Usage Tips:
- Specify the exploreName, dimensions, metrics, and any filters needed for your query
- Results are returned as CSV formatted text
- Use this when you need to analyze data or export query results
- The query respects the same limits and permissions as other visualization tools
`;
exports.toolRunMetricQueryArgsSchema = (0, toolSchemaBuilder_1.createToolSchema)()
    .extend({
    vizConfig: visualizations_1.tableVizConfigSchema,
    customMetrics: customMetrics_1.customMetricsSchema,
    tableCalculations: tableCalcs_1.tableCalcsSchema,
    filters: filters_1.filtersSchemaV2
        .nullable()
        .describe('Filters to apply to the query. Filtered fields must exist in the selected explore or should be referenced from the custom metrics.'),
})
    .build();
exports.toolRunMetricQueryArgsSchemaTransformed = exports.toolRunMetricQueryArgsSchema.transform((data) => ({
    ...data,
    customMetrics: customMetrics_1.customMetricsSchemaTransformed.parse(data.customMetrics ?? []),
    filters: filters_1.filtersSchemaTransformed.parse(data.filters ?? null),
}));
exports.toolRunMetricQueryOutputSchema = zod_1.z.object({
    result: zod_1.z.string(),
    metadata: outputMetadata_1.baseOutputMetadataSchema,
});
//# sourceMappingURL=toolRunMetricQueryArgs.js.map