var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Settings;
(function (Settings) {
    var Gadget;
    (function (Gadget) {
        // Settings.Gadget.SettingGroup.Summary
        Gadget.SettingGroup = $.extend(Gadget.SettingGroup, {
            SankeySetup: "0b4670d5-d4d4-4256-8106-1b7636990bfd"
        });
        Gadget.MaxLevel = { id: Settings.Gadget.SettingGroup.SankeySetup, name: "MaxLevel" };
        Gadget.LastLogOnly = { id: Settings.Gadget.SettingGroup.SankeySetup, name: "LastLogOnly" };
        Gadget.ShowDataWarning = { id: Settings.Gadget.SettingGroup.SankeySetup, name: "ShowDataWarning" };
        Gadget.ApplyUniqueColours = { id: Settings.Gadget.SettingGroup.SankeySetup, name: "ApplyUniqueColours" };
    })(Gadget = Settings.Gadget || (Settings.Gadget = {}));
})(Settings || (Settings = {}));
var Dashboards;
(function (Dashboards) {
    var SetupControl;
    (function (SetupControl) {
        var SankeySetup = (function (_super) {
            __extends(SankeySetup, _super);
            function SankeySetup() {
                _super.call(this, Settings.Gadget.SettingGroup.SankeySetup);
                this.title = i18n.loc.s('ISO50001Gadgets', 'Sankey_Chart_Setup');
            }
            SankeySetup.CreateInstance = function () {
                var instance = new SankeySetup();
                return instance;
            };
            SankeySetup.prototype.draw = function () {
                var _this = this;
                this.$container.empty();
                TemplateUtil.LocAndLoad(SankeySetup.SetupControlTemplateUri, new Core.CallBack(function (template) {
                    _this.$container.html(template);
                    _this.render();
                }, this));
            };
            SankeySetup.prototype.isConfigured = function () {
                return true;
            };
            SankeySetup.prototype.isManagedSetting = function (name) {
                var managed = false;
                switch (name) {
                    case Settings.Gadget.MaxLevel.name:
                    case Settings.Gadget.LastLogOnly.name:
                    case Settings.Gadget.ShowDataWarning.name:
                    case Settings.Gadget.ApplyUniqueColours.name:
                        managed = true;
                        break;
                }
                ;
                return managed;
            };
            SankeySetup.prototype.beforeCommit = function () {
                var maxlevel = this.$container.find('#max-level').val();
                this.setting(Settings.Gadget.MaxLevel.name, maxlevel);
                var lastlogonly = this.$container.find('#last-log-only').prop('checked');
                this.setting(Settings.Gadget.LastLogOnly.name, lastlogonly.toString());
                var showdatawarning = this.$container.find('#show-data-warning').prop('checked');
                this.setting(Settings.Gadget.ShowDataWarning.name, showdatawarning.toString());
                var applyuniquecolours = this.$container.find('#apply-unique-colours').prop('checked');
                this.setting(Settings.Gadget.ApplyUniqueColours.name, applyuniquecolours.toString());
            };
            SankeySetup.prototype.render = function () {
                var maxlevel = this.$container.find('#max-level');
                maxlevel.val(this.setting(Settings.Gadget.MaxLevel.name).toString());
                var lastlogchecked = this.setting(Settings.Gadget.LastLogOnly.name).toString().toLowerCase() === 'true';
                this.$container.find('#last-log-only').prop('checked', lastlogchecked);
                var showdatawarning = this.setting(Settings.Gadget.ShowDataWarning.name).toString().toLowerCase() === 'true';
                this.$container.find('#show-data-warning').prop('checked', showdatawarning);
                var applyuniquecolours = this.setting(Settings.Gadget.ApplyUniqueColours.name).toString().toLowerCase() === 'true';
                this.$container.find('#apply-unique-colours').prop('checked', applyuniquecolours);
            };
            SankeySetup.SetupControlTemplateUri = 'Content/Gadgets/Sankey/SankeyGadgetSetup.html';
            return SankeySetup;
        }(Dashboards.Models.SetupControl));
        SetupControl.SankeySetup = SankeySetup;
    })(SetupControl = Dashboards.SetupControl || (Dashboards.SetupControl = {}));
})(Dashboards || (Dashboards = {}));
// Register the Setup Control
Dashboards.Controllers.SetupControl.Register({
    create: Dashboards.SetupControl.SankeySetup.CreateInstance,
    id: Settings.Gadget.SettingGroup.SankeySetup
});
//# sourceMappingURL=SankeyGadgetSetup.js.map