import { bindingMode } from "aurelia-binding";
import { bindable, customElement } from "aurelia-templating";

@customElement("ui-segmented-option")
export class UISegmentedOption {
    @bindable({ defaultBindingMode: bindingMode.twoWay })
    public checked: AnyObject;
    @bindable()
    public model: AnyObject;

    public name: string;

    @bindable()
    public disabled: boolean = false;

    @bindable()
    public label: string;

    public updateGUI: () => void;

    constructor(public element: Element) { }

    checkedChanged() {
        if (this.updateGUI != null) {
            this.updateGUI();
        }
    }

    modelChanged() {
        if (this.updateGUI != null) {
            this.updateGUI();
        }
    }
}