import { z } from "zod";
import { dictionaryEntrySortModeSchema } from "../lib/entrySort.js";
const dictionaryKeySchema = z.string().trim().min(1).max(100).regex(/^[a-z0-9][a-z0-9_-]*$/, "Use lowercase letters, numbers, hyphen, or underscore.");
const hexColorSchema = z.string().trim().regex(/^#([0-9a-fA-F]{6})$/, "Color must be a valid six-digit hex code like #3366ff");
const iconSchema = z.string().trim().min(1).max(64);
const upsertDictionarySchema = z.object({
  key: dictionaryKeySchema,
  name: z.string().trim().min(1).max(200),
  description: z.string().trim().max(2e3).optional(),
  isSystem: z.boolean().optional(),
  isActive: z.boolean().optional(),
  entrySortMode: dictionaryEntrySortModeSchema.optional()
});
const createDictionaryEntrySchema = z.object({
  value: z.string().trim().min(1).max(150),
  label: z.string().trim().min(1).max(150).optional(),
  color: hexColorSchema.nullable().optional(),
  icon: iconSchema.nullable().optional(),
  position: z.number().int().min(0).optional()
});
const dictionaryEntryUpdateFieldsSchema = z.object({
  value: z.string().trim().min(1).max(150).optional(),
  label: z.string().trim().min(1).max(150).optional(),
  color: hexColorSchema.nullable().optional(),
  icon: iconSchema.nullable().optional(),
  position: z.number().int().min(0).optional(),
  isDefault: z.boolean().optional()
});
const validateDictionaryEntryUpdate = (payload) => Object.keys(payload).length > 0;
const updateDictionaryEntrySchema = dictionaryEntryUpdateFieldsSchema.refine(
  validateDictionaryEntryUpdate,
  {
    message: "Provide at least one field to update."
  }
);
const dictionaryEntryCommandCreateSchema = createDictionaryEntrySchema.extend({
  dictionaryId: z.string().uuid()
});
const dictionaryEntryCommandUpdateSchema = z.object({
  id: z.string().uuid()
}).merge(dictionaryEntryUpdateFieldsSchema).refine(validateDictionaryEntryUpdate, {
  message: "Provide at least one field to update."
});
const reorderDictionaryEntriesSchema = z.object({
  entries: z.array(z.object({
    id: z.string().uuid(),
    position: z.number().int().min(0)
  })).min(1)
});
const reorderDictionaryEntriesCommandSchema = reorderDictionaryEntriesSchema.extend({
  dictionaryId: z.string().uuid(),
  tenantId: z.string().uuid(),
  organizationId: z.string().uuid()
});
const setDefaultDictionaryEntrySchema = z.object({
  entryId: z.string().uuid()
});
const setDefaultDictionaryEntryCommandSchema = setDefaultDictionaryEntrySchema.extend({
  dictionaryId: z.string().uuid(),
  tenantId: z.string().uuid(),
  organizationId: z.string().uuid()
});
export {
  createDictionaryEntrySchema,
  dictionaryEntryCommandCreateSchema,
  dictionaryEntryCommandUpdateSchema,
  dictionaryKeySchema,
  reorderDictionaryEntriesCommandSchema,
  reorderDictionaryEntriesSchema,
  setDefaultDictionaryEntryCommandSchema,
  setDefaultDictionaryEntrySchema,
  updateDictionaryEntrySchema,
  upsertDictionarySchema
};
//# sourceMappingURL=validators.js.map
