import { getOptions } from "@tego/client";
import { CollectionTemplate } from "../../data-source/collection-template/CollectionTemplate.mjs";
import { getConfigurableProperties } from "./properties/index.mjs";
function _define_property(obj, key, value) {
    if (key in obj) Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
    });
    else obj[key] = value;
    return obj;
}
class ExpressionCollectionTemplate extends CollectionTemplate {
    constructor(...args){
        super(...args), _define_property(this, "name", 'expression'), _define_property(this, "title", '{{t("Expression collection")}}'), _define_property(this, "order", 4), _define_property(this, "color", 'orange'), _define_property(this, "default", {
            createdBy: true,
            updatedBy: true,
            createdAt: true,
            updatedAt: true,
            sortable: true,
            fields: [
                {
                    name: 'engine',
                    type: 'string',
                    interface: 'radioGroup',
                    uiSchema: {
                        type: 'string',
                        title: '{{t("Calculation engine")}}',
                        'x-component': 'Radio.Group',
                        enum: getOptions(),
                        default: 'formula.js'
                    }
                },
                {
                    name: 'sourceCollection',
                    type: 'string',
                    interface: 'select',
                    uiSchema: {
                        type: 'string',
                        title: '{{t("Collection")}}',
                        'x-component': 'CollectionSelect',
                        'x-component-props': {}
                    }
                },
                {
                    name: 'expression',
                    type: 'text',
                    interface: 'expression',
                    uiSchema: {
                        type: 'string',
                        title: '{{t("Expression")}}',
                        'x-component': 'DynamicExpression'
                    }
                }
            ]
        }), _define_property(this, "availableFieldInterfaces", {
            include: []
        }), _define_property(this, "configurableProperties", getConfigurableProperties('title', 'name', 'inherits', 'category', "description", 'presetFields'));
    }
}
export { ExpressionCollectionTemplate };
