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

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

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

// ----------------------------------------------      ----------------------------------------------
// | ESC  |  1   |  2  |  3   |  4  |  5  |  6  |      |  7  |  8  |  9  |  0  |  -  |  =  |  BKSPC |
// | TAB   |  Q   |  W  |  E   |  R  |  T  |        |  Y  |  U  |  I  |  O  |  P  |  [  |  ]  |  \  |
// | LCTRL  |  A   |  S  |  D   |  F  |  G  |        |  H  |  J  |  K  |  L  |  ;  |  '  |   ENTER  |
// | SHIFT   |  Z   |  X  |  C  |  V   |  B  |        |  N  |  M  |  ,  |  .  |  /  |  RSHFT  |  UP |
// | LCTRL   | LGUI | LALT    |     SPACE    |        |    SPACE    | RALT | FN | RCTRL | LFT | DWN |
// -------------------------------------------        -----------------------------------------------

        default_layer {
            bindings = <
    &kp ESC  &kp NUM_1 &kp NUM_2 &kp NUM_3 &kp NUM_4 &kp NUM_5 &kp NUM_6  /**/  &kp NUM_7 &kp NUM_8 &kp NUM_9 &kp NUM_0 &kp MINUS &kp EQL  &kp BKSP &kp BKSP 
    &kp TAB  &kp Q     &kp W     &kp E     &kp R     &kp T                /**/  &kp Y     &kp U     &kp I     &kp O     &kp P     &kp LBKT &kp RBKT &kp BSLH
    &bt BT_CLR &kp A     &kp S     &kp D     &kp F     &kp G                /**/  &kp H     &kp J     &kp K     &kp L     &kp SCLN  &kp QUOT          &kp RET   
    &kp LSFT &kp Z     &kp X     &kp C     &kp V     &kp B                /**/  &kp N     &kp M     &kp CMMA  &kp DOT   &kp FSLH  &kp RSFT &kp UARW &mo 1 
    &kp LCTL &kp LGUI  &kp LALT            &kp SPC                        /**/            &kp SPC   &kp RALT  &mo 1               &kp LARW &kp DARW &kp RARW
            >;
        };

// ----------------------------------------------     ----------------------------------------------
// |BT_CLR|  F1  |  F2 |  F3  |  F4 |  F5 |  F6 |     |  F7 |  F8 |  F9 | F10 | F11 | F12 |        | 
// |       | BT-0 | BT-1| BT-2 |     |     |       |     |     |     |     |     |     |     |     |
// |        |      |     |      |     |     |       |     |     |     |     |     |     |          |
// |         |      |     |     |      |     |       |     |     |     |     |     |         |     |
// |         |      |      |           |     |       |             |      |    |       |     |     |
// -------------------------------------------       -----------------------------------------------

        fn_layer {
            bindings = <
    &bt BT_CLR &kp F1       &kp F2       &kp F3       &kp F4 &kp F5 &kp F6 /**/ &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &trans &bt BT_CLR
    &trans     &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &trans &trans        /**/ &trans &trans &trans &trans  &trans  &trans  &trans &trans
    &trans     &trans       &trans       &trans       &trans &trans        /**/ &trans &trans &trans &trans  &trans  &trans         &trans
    &trans     &trans       &trans       &trans       &trans &trans        /**/ &trans &trans &trans &trans  &trans  &trans  &trans &trans
    &trans     &trans       &trans                    &trans               /**/        &trans &trans &trans          &trans  &trans &trans       
            >;
        };
    };
};
