import { jsonSchema } from "../../shared/src/json-schema.js";
import * as v from "../../shared/src/valita.js";
import { astSchema } from "./ast.js";
const inspectUpBase = v.object({
    id: v.string(),
});
const inspectQueriesUpBodySchema = inspectUpBase.extend({
    op: v.literal('queries'),
    clientID: v.string().optional(),
});
const inspectMetricsUpSchema = inspectUpBase.extend({
    op: v.literal('metrics'),
});
const inspectVersionUpSchema = inspectUpBase.extend({
    op: v.literal('version'),
});
export const inspectAuthenticateUpSchema = inspectUpBase.extend({
    op: v.literal('authenticate'),
    value: v.string(),
});
const analyzeQueryOptionsSchema = v.object({
    vendedRows: v.boolean().optional(),
    syncedRows: v.boolean().optional(),
});
export const inspectAnalyzeQueryUpSchema = inspectUpBase.extend({
    op: v.literal('analyze-query'),
    /** @deprecated Use {@linkcode ast} instead */
    value: astSchema.optional(),
    options: analyzeQueryOptionsSchema.optional(),
    ast: astSchema.optional(),
    name: v.string().optional(),
    args: v.readonlyArray(jsonSchema).optional(),
});
const inspectUpBodySchema = v.union(inspectQueriesUpBodySchema, inspectMetricsUpSchema, inspectVersionUpSchema, inspectAuthenticateUpSchema, inspectAnalyzeQueryUpSchema);
export const inspectUpMessageSchema = v.tuple([
    v.literal('inspect'),
    inspectUpBodySchema,
]);
//# sourceMappingURL=inspect-up.js.map