"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var schemas_exports = {};
__export(schemas_exports, {
  columnSchema: () => columnSchema
});
module.exports = __toCommonJS(schemas_exports);
var sdk = __toESM(require("@botpress/sdk"));
const commonProps = {
  "x-zui": sdk.z.object({
    index: sdk.z.number().optional().describe("Index of the column in the table"),
    typings: sdk.z.string().optional().describe("[deprecated] Typescript typings for the object"),
    title: sdk.z.string().optional(),
    searchable: sdk.z.boolean().optional().describe("Indicates if the field is vectorized and searchable."),
    hidden: sdk.z.boolean().optional().describe("Indicates if the field is hidden in the UI"),
    order: sdk.z.number().optional().describe("Order of the column in the UI"),
    width: sdk.z.number().optional().describe("Width of the column in the UI"),
    schemaId: sdk.z.string().optional().describe("ID of the schema"),
    computed: sdk.z.object({
      action: sdk.z.enum(["ai", "code", "workflow"]),
      dependencies: sdk.z.array(sdk.z.string()).default([]),
      prompt: sdk.z.string().optional().describe('Prompt when action is "ai"'),
      code: sdk.z.string().optional().describe('Code to execute when action is "code"'),
      model: sdk.z.string().max(80).default("gpt-4o").optional().describe('Model to use when action is "ai"'),
      workflowId: sdk.z.string().max(20).optional().describe('ID of Workflow to execute when action is "workflow"'),
      enabled: sdk.z.boolean().optional()
    }).optional()
  }).passthrough().optional(),
  nullable: sdk.z.boolean().optional(),
  description: sdk.z.string().optional(),
  default: sdk.z.any().optional()
};
const baseObjectSchema = sdk.z.object({}).passthrough();
const baseArraySchema = sdk.z.object({}).passthrough();
const baseSchemas = {
  string: sdk.z.object({
    type: sdk.z.literal("string"),
    format: sdk.z.string().optional(),
    pattern: sdk.z.string().optional(),
    enum: sdk.z.array(sdk.z.string()).optional(),
    minLength: sdk.z.number().optional(),
    maxLength: sdk.z.number().optional()
  }).extend(commonProps),
  number: sdk.z.object({
    type: sdk.z.literal("number"),
    minimum: sdk.z.number().optional(),
    maximum: sdk.z.number().optional()
  }).extend(commonProps),
  boolean: sdk.z.object({
    type: sdk.z.literal("boolean")
  }).extend(commonProps),
  object: baseObjectSchema.extend({
    type: sdk.z.literal("object"),
    properties: sdk.z.record(baseObjectSchema).optional(),
    required: sdk.z.array(sdk.z.string()).optional(),
    additionalProperties: sdk.z.union([sdk.z.boolean(), sdk.z.object({}).passthrough()]).optional()
  }).extend(commonProps),
  array: baseArraySchema.extend({
    type: sdk.z.literal("array"),
    items: baseArraySchema.optional(),
    minItems: sdk.z.number().optional(),
    maxItems: sdk.z.number().optional()
  }).extend(commonProps),
  null: sdk.z.object({
    type: sdk.z.literal("null")
  })
};
const columnSchema = sdk.z.discriminatedUnion("type", [
  baseSchemas.string,
  baseSchemas.number,
  baseSchemas.boolean,
  baseSchemas.object,
  baseSchemas.array,
  baseSchemas.null
]);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  columnSchema
});
//# sourceMappingURL=schemas.js.map
