// src/schemas/columnType/columnTypeJSONSchema.ts
import { z as z5 } from "zod";

// src/schemas/columnType/columnTypeBaseAdminConfigSchema.ts
import { z } from "zod";
var FieldPlacements;
(function(FieldPlacements2) {
  FieldPlacements2["MAIN"] = "main";
  FieldPlacements2["ASIDE"] = "aside";
})(FieldPlacements || (FieldPlacements = {}));
var columnTypeBaseAdminConfigSchema = z.object({
  isHidden: z.boolean().default(false),
  editor: z.object({
    placement: z.nativeEnum(FieldPlacements).default(FieldPlacements.MAIN)
  }).default({})
});

// src/schemas/columnType/columnTypeBaseSchema.ts
import { z as z2 } from "zod";
var columnTypeBaseSchema = z2.object({
  title: z2.string(),
  hide: z2.boolean().default(false),
  required: z2.boolean().default(false),
  unique: z2.boolean().default(false),
  editable: z2.boolean().default(true),
  translations: z2.boolean().default(true),
  admin: columnTypeBaseAdminConfigSchema.default({})
});

// src/schemas/columnType/columnTypeNumberSchema.ts
import { z as z3 } from "zod";
var columnTypeNumberSchema = columnTypeBaseSchema.extend({
  type: z3.enum([
    "number"
  ]),
  autoIncrement: z3.boolean().optional(),
  default: z3.number().optional()
});

// src/schemas/columnType/columnTypeStringSchema.ts
import { z as z4 } from "zod";
var columnTypeStringSchema = columnTypeBaseSchema.extend({
  type: z4.enum([
    "string"
  ]),
  admin: columnTypeBaseAdminConfigSchema.extend({
    fieldType: z4.enum([
      "heading",
      "normal"
    ]).default("normal")
  }).default({})
});

// src/schemas/columnType/columnTypeJSONSchema.ts
var basicAdminSchema = columnTypeBaseAdminConfigSchema.extend({
  fieldType: z5.enum([
    "blockEditor",
    "jsonEditor",
    "openingHours"
  ])
});
var basicExtend = z5.object({
  title: z5.string().optional()
});
var basicOmit = {
  admin: true,
  unique: true,
  translations: true,
  title: true
};
var repeaterAdminSchema = columnTypeBaseAdminConfigSchema.extend({
  fieldType: z5.enum([
    "repeater"
  ]),
  columns: z5.record(z5.discriminatedUnion("type", [
    columnTypeStringSchema.omit(basicOmit).merge(basicExtend),
    columnTypeNumberSchema.omit({
      ...basicOmit,
      translations: true
    }).merge(basicExtend)
  ])).transform((columns) => new Map(Object.entries(columns)))
});
var columnTypeJSONSchema = columnTypeBaseSchema.extend({
  type: z5.enum([
    "json"
  ]),
  admin: z5.discriminatedUnion("fieldType", [
    repeaterAdminSchema,
    basicAdminSchema
  ]).default({
    fieldType: "jsonEditor"
  })
});
export {
  columnTypeJSONSchema,
  repeaterAdminSchema
};
//# sourceMappingURL=columnTypeJSONSchema.js.map