"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FieldsValidationSchema = exports.fields = void 0;
const extensions_core_1 = require("@awell-health/extensions-core");
const core_1 = require("@medplum/core");
const zod_1 = __importDefault(require("zod"));
exports.fields = {
    imageUrl: {
        id: 'imageUrl',
        label: 'Image URL',
        description: 'The URL to the uploaded image',
        type: extensions_core_1.FieldType.STRING,
        required: true,
    },
    medicationData: {
        id: 'medicationData',
        label: 'Medication data',
        description: 'The medication data to review',
        type: extensions_core_1.FieldType.JSON,
        required: true,
    },
};
exports.FieldsValidationSchema = zod_1.default.object({
    imageUrl: zod_1.default.string().url(),
    medicationData: zod_1.default.string().transform((str, ctx) => {
        if ((0, core_1.isEmpty)(str))
            return {};
        try {
            return JSON.parse(str);
        }
        catch (e) {
            ctx.addIssue({ code: 'custom', message: 'Invalid JSON' });
            return zod_1.default.NEVER;
        }
    }),
});
//# sourceMappingURL=fields.js.map