// src/schemas/columnType/columnTypeSchema.ts
import { z as z12 } from "zod";

// src/schemas/columnType/columnTypeBooleanSchema.ts
import { z as z3 } from "zod";

// src/schemas/columnType/columnTypeBaseSchema.ts
import { z as z2 } 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
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/columnTypeBooleanSchema.ts
var columnTypeBooleanSchema = columnTypeBaseSchema.extend({
  type: z3.enum([
    "boolean"
  ]),
  default: z3.boolean().optional()
});

// src/schemas/columnType/columnTypeEnumSchema.ts
import { z as z4 } from "zod";
var columnTypeEnumSchema = columnTypeBaseSchema.extend({
  type: z4.enum([
    "enum"
  ]),
  enum: z4.array(z4.string().min(1)),
  default: z4.string().optional()
});

// src/schemas/columnType/columnTypeFileSchema.ts
import { z as z5 } from "zod";
var columnTypeFileSchema = columnTypeBaseSchema.extend({
  type: z5.enum([
    "file"
  ]),
  multiple: z5.boolean().default(false),
  typeFilter: z5.string().optional(),
  admin: columnTypeBaseAdminConfigSchema.extend({
    fieldType: z5.enum([
      "normal",
      "big-image"
    ]).default("normal")
  }).default({})
});

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

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

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

// src/schemas/columnType/columnTypeJSONSchema.ts
var basicAdminSchema = columnTypeBaseAdminConfigSchema.extend({
  fieldType: z8.enum([
    "blockEditor",
    "jsonEditor",
    "openingHours"
  ])
});
var basicExtend = z8.object({
  title: z8.string().optional()
});
var basicOmit = {
  admin: true,
  unique: true,
  translations: true,
  title: true
};
var repeaterAdminSchema = columnTypeBaseAdminConfigSchema.extend({
  fieldType: z8.enum([
    "repeater"
  ]),
  columns: z8.record(z8.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: z8.enum([
    "json"
  ]),
  admin: z8.discriminatedUnion("fieldType", [
    repeaterAdminSchema,
    basicAdminSchema
  ]).default({
    fieldType: "jsonEditor"
  })
});

// src/schemas/columnType/columnTypeNormalSchema.ts
import { z as z9 } from "zod";
var columnTypeNormalSchema = columnTypeBaseSchema.extend({
  type: z9.enum([
    "date",
    "password",
    "dateTime",
    "longText"
  ]),
  default: z9.string().optional()
});

// src/schemas/columnType/columnTypeRelationshipSchema.ts
import { z as z10 } from "zod";
var columnTypeRelationshipSchema = columnTypeBaseSchema.extend({
  type: z10.enum([
    "relationship"
  ]),
  targetModel: z10.string(),
  labelConstructor: z10.string(),
  multiple: z10.boolean().default(false),
  fill: z10.boolean().default(true),
  foreignKey: z10.string().default("id")
});

// src/schemas/columnType/columnTypeSlugSchema.ts
import { z as z11 } from "zod";
var columnTypeSlugSchema = columnTypeBaseSchema.extend({
  type: z11.enum([
    "slug"
  ]),
  of: z11.string()
});

// src/schemas/columnType/columnTypeSchema.ts
var columnTypeSchema = z12.union([
  columnTypeNormalSchema,
  columnTypeJSONSchema,
  columnTypeStringSchema,
  columnTypeEnumSchema,
  columnTypeFileSchema,
  columnTypeNumberSchema,
  columnTypeRelationshipSchema,
  columnTypeSlugSchema,
  columnTypeBooleanSchema
]);
export {
  columnTypeSchema
};
//# sourceMappingURL=columnTypeSchema.js.map