/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import * as tslib_1 from "tslib";
import { NativeUIElementBridge } from "./NativeUIElementBridge";
import { runOn, enumGetBox, typeCast, EnumUtil, markType } from "./type";
import { NativeUIComponent } from "./NativeUIComponent";
import { NativeUIButtonClickedEventArgs } from "./NativeUIButtonClickedEventArgs";
import { NativeUIDisplayDensity_$type } from "./NativeUIDisplayDensity";
/**
 * @hidden
 */
var IgcButtonBridge = /** @class */ /*@__PURE__*/ (function (_super) {
    tslib_1.__extends(IgcButtonBridge, _super);
    function IgcButtonBridge() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.e = null;
        _this.c = null;
        _this.f = null;
        _this.g = null;
        _this.d = null;
        return _this;
    }
    IgcButtonBridge.prototype.addHandler = function (a, b, c, d) {
        switch (c) {
            case 1:
                var e = a;
                this.e = e.listen("click", runOn(this, this.h));
                this.c = d;
                this.f = b;
                break;
        }
    };
    IgcButtonBridge.prototype.h = function (a) {
        if (this.c != null) {
            var b = new NativeUIButtonClickedEventArgs();
            this.c(this.f, b);
        }
    };
    IgcButtonBridge.prototype.getValue = function (a, b) {
        switch (b) {
            case 3: return this.d != null ? this.d : this.g;
            case 1:
                var c = a.getProperty("size");
                var d = 1;
                switch (c) {
                    case "small":
                        d = 2;
                        break;
                    case "medium":
                        d = 3;
                        break;
                    case "large":
                        d = 1;
                        break;
                    default:
                        d = 1;
                        break;
                }
                return enumGetBox(NativeUIDisplayDensity_$type, d);
        }
        return null;
    };
    IgcButtonBridge.prototype.removeHandler = function (a, b, c, d) {
        switch (c) {
            case 1:
                if (this.e != null) {
                    this.e();
                }
                this.c = null;
                this.f = null;
                break;
        }
    };
    IgcButtonBridge.prototype.setValue = function (a, b, c) {
        switch (b) {
            case 3:
                if (typeCast(NativeUIComponent.$, c) !== null) {
                    this.d = c;
                    a.append(this.d.x);
                }
                else {
                    this.g = c == null ? null : c.toString();
                    a.setText(this.g);
                }
                break;
            case 1:
                var d = "large";
                switch (EnumUtil.getEnumValue(NativeUIDisplayDensity_$type, c)) {
                    case 0:
                        d = "large";
                        break;
                    case 1:
                        d = "large";
                        break;
                    case 2:
                        d = "small";
                        break;
                    case 3:
                        d = "medium";
                        break;
                }
                a.setProperty("size", d);
                break;
        }
    };
    IgcButtonBridge.$t = markType(IgcButtonBridge, 'IgcButtonBridge', NativeUIElementBridge.$);
    return IgcButtonBridge;
}(NativeUIElementBridge));
export { IgcButtonBridge };
