"use strict";
/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.QueryReportRequest$outboundSchema = exports.QueryReportRequest$inboundSchema = exports.GroupBy$outboundSchema = exports.GroupBy$inboundSchema = exports.Grain$outboundSchema = exports.Grain$inboundSchema = exports.Metric$outboundSchema = exports.Metric$inboundSchema = exports.GroupBy = exports.Grain = exports.Metric = void 0;
exports.queryReportRequestToJSON = queryReportRequestToJSON;
exports.queryReportRequestFromJSON = queryReportRequestFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const filter_js_1 = require("./filter.js");
/**
 * Catalogue metric to query.
 */
exports.Metric = {
    GenaiRequests: "genai.requests",
    GenaiTokens: "genai.tokens",
    GenaiCost: "genai.cost",
    GenaiErrors: "genai.errors",
    GenaiLatencyP50: "genai.latency.p50",
    GenaiLatencyP95: "genai.latency.p95",
    GenaiLatencyP99: "genai.latency.p99",
    GenaiEvaluatorRuns: "genai.evaluator.runs",
    GenaiEvaluatorPassRate: "genai.evaluator.pass_rate",
    GenaiEvaluatorScoreAvg: "genai.evaluator.score.avg",
    GenaiGuardrailRuns: "genai.guardrail.runs",
    GenaiGuardrailBlockRate: "genai.guardrail.block_rate",
    GenaiGuardrailTriggered: "genai.guardrail.triggered",
    GenaiUsage: "genai.usage",
};
/**
 * Requested bucket grain. Use `auto` or omit the field to let the server choose based on the requested range.
 */
exports.Grain = {
    Auto: "auto",
    Minute: "minute",
    Hour: "hour",
    Day: "day",
};
exports.GroupBy = {
    Project: "project",
    Identity: "identity",
    Provider: "provider",
    Model: "model",
    Product: "product",
    ApiKey: "api_key",
    StatusCode: "status_code",
    HttpStatusCode: "http_status_code",
    CredentialType: "credential_type",
    Dimension: "dimension",
    DimensionType: "dimension_type",
    Tag: "tag",
    Agent: "agent",
    Tool: "tool",
    Deployment: "deployment",
    Evaluator: "evaluator",
    Dataset: "dataset",
    Prompt: "prompt",
    Policy: "policy",
    Conversation: "conversation",
    Thread: "thread",
    MemoryStore: "memory_store",
    Knowledge: "knowledge",
    Sheet: "sheet",
    GuardrailOrigin: "guardrail_origin",
    EvaluatorName: "evaluator_name",
    EvaluatorType: "evaluator_type",
    EvaluatorVersion: "evaluator_version",
    ResultType: "result_type",
    EvaluationStage: "evaluation_stage",
    GuardrailStage: "guardrail_stage",
    EvaluatorStage: "evaluator_stage",
    GuardrailAction: "guardrail_action",
    ResultLabel: "result_label",
};
/** @internal */
exports.Metric$inboundSchema = z
    .nativeEnum(exports.Metric);
/** @internal */
exports.Metric$outboundSchema = exports.Metric$inboundSchema;
/** @internal */
exports.Grain$inboundSchema = z.nativeEnum(exports.Grain);
/** @internal */
exports.Grain$outboundSchema = exports.Grain$inboundSchema;
/** @internal */
exports.GroupBy$inboundSchema = z
    .nativeEnum(exports.GroupBy);
/** @internal */
exports.GroupBy$outboundSchema = exports.GroupBy$inboundSchema;
/** @internal */
exports.QueryReportRequest$inboundSchema = z.object({
    metric: exports.Metric$inboundSchema,
    from: z.string().datetime({ offset: true }).transform(v => new Date(v)),
    to: z.string().datetime({ offset: true }).transform(v => new Date(v)),
    grain: exports.Grain$inboundSchema.optional(),
    group_by: z.array(exports.GroupBy$inboundSchema).optional(),
    filters: z.array(filter_js_1.Filter$inboundSchema).optional(),
    limit: z.number().int().optional(),
    time_zone: z.string().optional(),
    include_totals: z.boolean().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "group_by": "groupBy",
        "time_zone": "timeZone",
        "include_totals": "includeTotals",
    });
});
/** @internal */
exports.QueryReportRequest$outboundSchema = z.object({
    metric: exports.Metric$outboundSchema,
    from: z.date().transform(v => v.toISOString()),
    to: z.date().transform(v => v.toISOString()),
    grain: exports.Grain$outboundSchema.optional(),
    groupBy: z.array(exports.GroupBy$outboundSchema).optional(),
    filters: z.array(filter_js_1.Filter$outboundSchema).optional(),
    limit: z.number().int().optional(),
    timeZone: z.string().optional(),
    includeTotals: z.boolean().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        groupBy: "group_by",
        timeZone: "time_zone",
        includeTotals: "include_totals",
    });
});
function queryReportRequestToJSON(queryReportRequest) {
    return JSON.stringify(exports.QueryReportRequest$outboundSchema.parse(queryReportRequest));
}
function queryReportRequestFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.QueryReportRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'QueryReportRequest' from JSON`);
}
//# sourceMappingURL=queryreportrequest.js.map