"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.returnObject = exports.dataPoints = void 0;
const extensions_core_1 = require("@awell-health/extensions-core");
const extensions_core_2 = require("@awell-health/extensions-core");
exports.dataPoints = {
    object: {
        key: 'object',
        valueType: 'json',
        jsonSchemaSource: {
            system: extensions_core_1.JsonSchemaSourceSystem.EXTENSION,
            key: 'example',
        },
    },
};
const fields = {
    array: {
        id: 'array',
        label: 'Send array instead of object',
        type: extensions_core_1.FieldType.BOOLEAN,
        required: false,
    },
};
exports.returnObject = {
    key: 'returnObject',
    category: extensions_core_2.Category.WORKFLOW,
    title: 'Return object',
    description: 'Return an object to be stored as a datapoint',
    fields,
    dataPoints: exports.dataPoints,
    previewable: false,
    onActivityCreated: async (payload, onComplete, onError) => {
        const mockObject = {
            message: 'Hello World',
            number: 123,
            array: [1, 2, 3],
            nested: { key: 'value' },
            boolean: true,
        };
        if (payload.fields.array === true) {
            await onComplete({
                data_points: {
                    object: JSON.stringify([mockObject]),
                },
            });
        }
        else {
            await onComplete({
                data_points: {
                    object: JSON.stringify(mockObject),
                },
            });
        }
    },
};
//# sourceMappingURL=index.js.map