/*
 * Copyright (c) 2022 The ZMK Contributors
 *
 * SPDX-License-Identifier: MIT
 */

#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/outputs.h>

#define DEF 0
#define LWR 1
#define RSE 2
#define FNC 3

/ {
    keymap {
        compatible = "zmk,keymap";

        default_layer {
            display-name = "Default Layer";
            bindings = <
                &kp ESC     &kp Q       &kp W       &kp E       &kp R       &kp T       &kp Y       &kp U       &kp I       &kp O     &kp P       &kp BSPC
                &kp TAB     &kp A       &kp S       &kp D       &kp F       &kp G       &kp H       &kp J       &kp K       &kp L     &kp SQT     &kp SEMI
                &kp LSHFT   &kp Z       &kp X       &kp C       &kp V       &kp B       &kp N       &kp M       &kp COMMA   &kp DOT   &kp UP      &kp ENTER
                &kp LCTRL   &kp LALT    &kp LGUI    &mo FNC     &mo LWR     &kp SPACE   &kp SPACE   &mo RSE     &kp SLASH   &kp LEFT  &kp DOWN  &kp RIGHT
            >;
        };

        lower_layer {
            display-name = "Lower Layer";
            bindings = <
                &kp TILDE   &kp EXCL    &kp AT      &kp HASH    &kp DLLR    &kp PRCNT   &kp CARET   &kp AMPS    &kp STAR    &kp LPAR    &kp RPAR        &kp BSPC
                &trans      &trans      &trans      &trans      &trans      &trans      &trans      &trans      &kp UNDER   &kp PLUS    &trans          &trans
                &trans      &trans      &trans      &trans      &trans      &trans      &trans      &trans      &kp LBRC    &kp RBRC    &kp C_VOL_UP    &trans
                &trans      &trans      &trans      &trans      &trans      &trans      &trans      &trans      &kp QMARK   &trans      &kp C_VOL_DN    &trans
            >;
        };

        raise_layer {
            display-name = "Raise Layer";
            bindings = <
                &kp GRAVE   &kp N1      &kp N2      &kp N3      &kp N4      &kp N5      &kp N6      &kp N7      &kp N8      &kp N9      &kp N0          &kp BSPC
                &trans      &trans      &trans      &trans      &trans      &trans      &trans      &trans      &kp MINUS   &kp EQUAL   &trans          &kp BSLH
                &trans      &trans      &trans      &trans      &trans      &trans      &trans      &trans      &kp LBKT    &kp RBKT    &kp C_VOL_UP    &trans
                &trans      &trans      &trans      &trans      &trans      &trans      &trans      &trans      &trans      &trans      &kp C_VOL_DN    &trans
            >;
        };

        function_layer {
            display-name = "Function Layer";
            bindings = <
                &bootloader     &kp F1          &kp F2          &kp F3          &kp F4          &kp F5          &kp F6      &kp F7      &kp F8      &kp F9      &kp F10     &trans
                &trans          &trans          &trans          &trans          &trans          &trans          &trans      &trans      &kp MINUS   &kp F11     &kp F12     &trans
                &bt BT_CLR      &bt BT_SEL 0    &bt BT_SEL 1    &bt BT_SEL 2    &bt BT_SEL 3    &bt BT_SEL 4    &trans      &trans      &trans      &trans      &trans      &trans
                &out OUT_BLE    &out OUT_USB    &out OUT_TOG    &trans          &trans          &trans          &trans      &trans      &trans      &trans      &trans      &trans
            >;
        };
    };
};
