define(['exports', 'aurelia-framework', 'aurelia-event-aggregator', './schema', './model', './toolbar-items'], function (exports, _aureliaFramework, _aureliaEventAggregator, _schema, _model, _toolbarItems) {
    'use strict';

    exports.__esModule = true;
    exports.SchemaTemplates = undefined;

    function _initDefineProp(target, property, descriptor, context) {
        if (!descriptor) return;
        Object.defineProperty(target, property, {
            enumerable: descriptor.enumerable,
            configurable: descriptor.configurable,
            writable: descriptor.writable,
            value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
        });
    }

    function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
        var desc = {};
        Object['ke' + 'ys'](descriptor).forEach(function (key) {
            desc[key] = descriptor[key];
        });
        desc.enumerable = !!desc.enumerable;
        desc.configurable = !!desc.configurable;

        if ('value' in desc || desc.initializer) {
            desc.writable = true;
        }

        desc = decorators.slice().reverse().reduce(function (desc, decorator) {
            return decorator(target, property, desc) || desc;
        }, desc);

        if (context && desc.initializer !== void 0) {
            desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
            desc.initializer = undefined;
        }

        if (desc.initializer === void 0) {
            Object['define' + 'Property'](target, property, desc);
            desc = null;
        }

        return desc;
    }

    function _initializerWarningHelper(descriptor, context) {
        throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
    }

    var _dec, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4;

    let SchemaTemplates = exports.SchemaTemplates = (_dec = (0, _aureliaFramework.inject)(_aureliaEventAggregator.EventAggregator), _dec(_class = (_class2 = class SchemaTemplates {

        constructor(eventAggregator) {
            _initDefineProp(this, 'toolbarItems', _descriptor, this);

            _initDefineProp(this, 'detailToolbarSelectedId', _descriptor2, this);

            _initDefineProp(this, 'schema', _descriptor3, this);

            _initDefineProp(this, 'model', _descriptor4, this);

            this.eventAggregator = eventAggregator;
            this.schema = _schema.template;
        }

        attached() {
            this.toolbarItems = _toolbarItems.toolbarItems;

            this.fetch(1);
        }

        detached() {
            this.schema = null;
            this.model = null;
            this.toolbarItems = null;
        }

        detailToolbarSelectedIdChanged(newValue) {
            alert(newValue);
        }

        fetch(id) {
            return new Promise(_ => {
                this.model = new _model.Model();
                this.model.id = id;
                this.model.code = `Code ${id}`;
                this.model.description = `Description ${id}`;
            });
        }

        show(template) {
            document.querySelector("pragma-form").au["pragma-form"].viewModel.showSchemaTemplate(template);
        }

        showBody() {
            document.querySelector("pragma-form").au["pragma-form"].viewModel.showSchemaBody();
        }
    }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'toolbarItems', [_aureliaFramework.bindable], {
        enumerable: true,
        initializer: null
    }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, 'detailToolbarSelectedId', [_aureliaFramework.bindable], {
        enumerable: true,
        initializer: null
    }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, 'schema', [_aureliaFramework.bindable], {
        enumerable: true,
        initializer: null
    }), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, 'model', [_aureliaFramework.bindable], {
        enumerable: true,
        initializer: null
    })), _class2)) || _class);
});
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNjaGVtYS10ZW1wbGF0ZXMuanMiXSwibmFtZXMiOlsiU2NoZW1hVGVtcGxhdGVzIiwiY29uc3RydWN0b3IiLCJldmVudEFnZ3JlZ2F0b3IiLCJzY2hlbWEiLCJhdHRhY2hlZCIsInRvb2xiYXJJdGVtcyIsImZldGNoIiwiZGV0YWNoZWQiLCJtb2RlbCIsImRldGFpbFRvb2xiYXJTZWxlY3RlZElkQ2hhbmdlZCIsIm5ld1ZhbHVlIiwiYWxlcnQiLCJpZCIsIlByb21pc2UiLCJfIiwiY29kZSIsImRlc2NyaXB0aW9uIiwic2hvdyIsInRlbXBsYXRlIiwiZG9jdW1lbnQiLCJxdWVyeVNlbGVjdG9yIiwiYXUiLCJ2aWV3TW9kZWwiLCJzaG93U2NoZW1hVGVtcGxhdGUiLCJzaG93Qm9keSIsInN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