"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.extractEnumValues = extractEnumValues; exports.makeEnumOptions = makeEnumOptions; /** * Extract enum values from a Zod enum or native enum schema. * Supports z.enum([...]) and z.nativeEnum(SomeTsEnum). */ function extractEnumValues(schema) { var _a, _b; // z.enum([...]) => schema.options exists if (Array.isArray(schema === null || schema === void 0 ? void 0 : schema.options)) { return schema.options; } // z.nativeEnum(SomeEnum) => schema._def?.values may exist or enum is in schema._def?.enum if (Array.isArray((_a = schema === null || schema === void 0 ? void 0 : schema._def) === null || _a === void 0 ? void 0 : _a.values)) { return schema._def.values; } if ((_b = schema === null || schema === void 0 ? void 0 : schema._def) === null || _b === void 0 ? void 0 : _b.enum) { // enum object -> values return Object.values(schema._def.enum); } throw new Error("Unsupported Zod schema type for enum extraction"); } /** * Build a runtime map: { VAL: "VAL", ... } with proper typing * so callers can import paymentStatusOptions.VOID etc. */ function makeEnumOptions(schema) { const values = extractEnumValues(schema); const map = {}; values.forEach((v) => { map[String(v)] = v; }); return map; }