"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConfigBundleSchema = exports.ComponentConfigurationMapSchema = exports.ComponentConfigurationSchema = exports.ConfigBundleDescriptionSchema = exports.ConfigBundleNameSchema = void 0;
const zod_1 = require("zod");
// ============================================================================
// Configuration Bundle Types
// ============================================================================
exports.ConfigBundleNameSchema = zod_1.z
    .string()
    .min(1, 'Name is required')
    .max(100)
    .regex(/^[a-zA-Z][a-zA-Z0-9_]{0,99}$/, 'Must begin with a letter and contain only alphanumeric characters and underscores (max 100 chars)');
exports.ConfigBundleDescriptionSchema = zod_1.z.string().min(1).max(500).optional();
/** Freeform configuration for a single component within a bundle. */
exports.ComponentConfigurationSchema = zod_1.z.object({
    configuration: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
});
/**
 * Map of component identifier (ARN or placeholder) to its configuration.
 *
 * Keys are typically resource ARNs (runtime ARN, gateway ARN) but may use
 * placeholder tokens like `{{runtime:<runtimeName>}}` when the bundle is created
 * before deploy and ARNs are not yet available.
 */
exports.ComponentConfigurationMapSchema = zod_1.z.record(zod_1.z.string(), exports.ComponentConfigurationSchema);
exports.ConfigBundleSchema = zod_1.z.object({
    name: exports.ConfigBundleNameSchema,
    /** Discriminator required by the CDK package's schema validation. */
    type: zod_1.z.literal('ConfigurationBundle').default('ConfigurationBundle'),
    description: exports.ConfigBundleDescriptionSchema,
    /** Component configurations keyed by component ARN or placeholder. */
    components: exports.ComponentConfigurationMapSchema,
    /** Optional branch name for versioning. */
    branchName: zod_1.z.string().max(128).optional(),
    /** Optional commit message for this version. */
    commitMessage: zod_1.z.string().max(500).optional(),
});
//# sourceMappingURL=config-bundle.js.map