/**
 * profile/schema.mjs — Zod schema for C19 profiles.
 *
 * Lives in `.mjs` (not the `.ts` sibling at `src/schemas/profile.ts`) so raw
 * Node can consume it from the apt-tools CLI without relying on experimental
 * TypeScript stripping. `src/schemas/profile.ts` re-exports these values and
 * layers on TS types for the schema-package surface.
 */
import { z } from 'zod';
export const SLUG_RE = /^[a-z0-9][a-z0-9-]*$/;
const SlugString = z
    .string()
    .regex(SLUG_RE, 'must match /^[a-z0-9][a-z0-9-]*$/ (lowercase, digits, hyphens)');
// Severity vocabulary matches the Principle shape emitted by
// src/cli/constitution/parse.mjs:parseAgentsMd so profile obligations append
// cleanly into the principle list without a translation layer.
export const SEVERITY_VALUES = ['must', 'should', 'never', 'principle', 'obligation'];
const SeverityEnum = z.enum(SEVERITY_VALUES);
export const ObligationSchema = z
    .object({
    id: z.string().regex(SLUG_RE, 'obligation id must match /^[a-z0-9][a-z0-9-]*$/'),
    title: z.string().min(1),
    text: z.string().min(1),
    severity: SeverityEnum,
})
    .strict();
const StringRecord = z.record(z.string(), z.string());
export const ProfileSchema = z
    .object({
    name: SlugString,
    extends: SlugString.optional(),
    description: z.string().optional(),
    obligations: z.array(ObligationSchema).optional(),
    conventions: StringRecord.optional(),
    tooling: StringRecord.optional(),
    merge_obligations: z.boolean().optional(),
    merge_conventions: z.boolean().optional(),
    merge_tooling: z.boolean().optional(),
})
    .strict();
export function validateProfile(data) {
    return ProfileSchema.safeParse(data);
}
//# sourceMappingURL=schema.mjs.map