"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.subtract = void 0;
const extensions_core_1 = require("@awell-health/extensions-core");
const config_1 = require("./config");
const zod_1 = require("zod");
exports.subtract = {
    key: 'subtract',
    title: 'Subtract',
    description: 'Calculate the difference between two numbers',
    category: extensions_core_1.Category.MATH,
    fields: config_1.fields,
    dataPoints: config_1.dataPoints,
    previewable: true,
    onActivityCreated: async (payload, onComplete, onError) => {
        const { fields: { minuend, subtrahend }, } = (0, extensions_core_1.validate)({
            schema: zod_1.z.object({ fields: config_1.FieldsValidationSchema }),
            payload,
        });
        const difference = minuend - subtrahend;
        await onComplete({
            data_points: {
                difference: String(difference),
                absoluteDifference: String(Math.abs(difference)),
            },
        });
    },
};
//# sourceMappingURL=subtract.js.map