"use strict";
/**
 * Zod schemas for Vercel global config types.
 *
 * Types are defined in types.ts (source of truth).
 * Schemas are generated by ts-to-zod and re-exported here with runtime
 * passthrough behavior for unrecognized config keys.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.authConfigSchema = exports.globalConfigSchema = exports.credStorageSchema = exports.updatesConfigSchema = exports.guidanceConfigSchema = exports.telemetryConfigSchema = void 0;
const zod_1 = require("zod");
const schema_zod_1 = require("./schema.zod");
const types_1 = require("./types");
function formatCredStorageError(value) {
    return `Invalid value for \`credStorage\`: ${JSON.stringify(value)}. Expected one of: ${types_1.CRED_STORAGE_CONFIG_VALUES.map(storage => JSON.stringify(storage)).join(', ')}.`;
}
exports.telemetryConfigSchema = schema_zod_1.telemetryConfigSchema.passthrough();
exports.guidanceConfigSchema = schema_zod_1.guidanceConfigSchema.passthrough();
exports.updatesConfigSchema = schema_zod_1.updatesConfigSchema.passthrough();
exports.credStorageSchema = zod_1.z
    .enum(types_1.CRED_STORAGE_CONFIG_VALUES, {
    error: issue => {
        return formatCredStorageError(issue.input);
    },
})
    .optional();
exports.globalConfigSchema = schema_zod_1.globalConfigSchema
    .extend({
    credStorage: exports.credStorageSchema,
    telemetry: exports.telemetryConfigSchema.optional(),
    guidance: exports.guidanceConfigSchema.optional(),
    updates: exports.updatesConfigSchema.optional(),
})
    .passthrough();
exports.authConfigSchema = schema_zod_1.authConfigSchema.passthrough();
