import { Button , VerticalBox, HorizontalBox} from "std-widgets.slint";
export component MainApp inherits Window {
    callback add(string);
    callback del();
    callback clear();
    callback confirm();
    in-out property <string> key;
    in-out property <int> len;
    VerticalBox {
        // width: 25%;
        alignment: center;
        TextInput{
            // input-type: password;
            text: root.key;
            horizontal-alignment: center;
            
        }
        HorizontalBox {
            Button {
                enabled: len <= 5;
                text: "1";
                clicked => {
                    add("1");
                }
            }
            Button {
                enabled: len <= 5;
                text: "2";
                clicked => {
                    add("2");
                }
            }
            Button {
                enabled: len <= 5;
                text: "3";
                clicked => {
                    add("3");
                }
            }
        }
        HorizontalBox {
            Button {
                enabled: len <= 5;
                text: "4";
                clicked => {
                    add("4");
                }
            }
            Button {
                enabled: len <= 5;
                text: "5";
                clicked => {
                    add("5");
                }
            }
            Button {
                enabled: len <= 5;
                text: "6";
                clicked => {
                    add("6");
                }
            }
        }
        HorizontalBox {
            Button {
                enabled: len <= 5;
                text: "7";
                clicked => {
                    add("7");
                }
            }
            Button {
                enabled: len <= 5;
                text: "8";
                clicked => {
                    add("8");
                }
            }
            Button {
                enabled: len <= 5;
                text: "9";
                clicked => {
                    add("9");
                }
            }
        }
        HorizontalBox {
            Button {
                text: "Temizle";
                clicked => {
                    clear();
                }
            }
            Button {
                enabled: len <= 5;
                text: "0";
                clicked => {
                    add("0");
                }
            }
            Button {
                text: "Sil";
                clicked => {
                    del();
                }
            }
        }
        HorizontalBox {
            Button {
                text: "Doğrula";
                enabled: len == 6;
                clicked => {
                    confirm();
                }
            }
        }
    }
}