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

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

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

                default_layer {
                        display-name = "Default Layer";
// -----------------------------------------------------------------------------------------
// |  Q  |  W  |  E  |  R  |  T   |   |  Y  |  U   |  I  |  O  |  P  |
// |  A  |  S  |  D  |  F  |  G   |   |  H  |  J   |  K  |  L  |  ;  |
// |  Z  |  X  |  C  |  V  |  B   |   |  N  |  M   |  ,  |  .  |  /  |
//             | GUI | NAV | SHFT |   | SPC | SYM  | ALT |
                        bindings = <
   &kp Q &kp W &kp E &kp R &kp T   &kp Y &kp U  &kp I     &kp O   &kp P
   &kp A &kp S &kp D &kp F &kp G   &kp H &kp J  &kp K     &kp L   &kp SEMI
   &kp Z &kp X &kp C &kp V &kp B   &kp N &kp M  &kp COMMA &kp DOT &kp FSLH
          &kp LGUI &mo 1 &kp LSHFT &kp SPACE &mo 2 &kp RALT
                        >;
                };
                nav_layer {
                        display-name = "Nav Layer";
// -----------------------------------------------------------------------------------------
// |BTCLR|     | ESC |  ~   |     |   | TAB | HOME |  UP  | END | DEL  |
// | BT1 | GUI | ALT | CTRL | NUM |   |  /  | LEFT | DOWN | RGT | BSPC |
// | BT2 |     |     |      |     |   |  \  | ENT  |      |     |      |
//             |     |      |     |   |     |      |      |
                        bindings = <
   &bt BT_CLR   &trans      &kp ESC  &kp TILDE &trans     &kp TAB  &kp HOME &kp UP   &kp END   &kp DEL
   &bt BT_SEL 0 &kp K_CMENU &kp RALT &kp LCTRL &mo 3      &kp FSLH &kp LEFT &kp DOWN &kp RIGHT &kp BSPC
   &bt BT_SEL 1 &trans      &trans   &trans    &trans     &kp BSLH &kp RET  &trans   &trans    &trans
                            &trans   &trans    &trans     &trans   &trans   &trans
                        >;
                };

                sym_layer {
                        display-name = "Sym Layer";
// -----------------------------------------------------------------------------------------
// |  !  |  @  |  #  |  $  |  %  |   |  ^  |  &  |  *  |  (  |  )  |
// |     |     |     |     |     |   |  -  |  =  |  {  |  }  | "|" |
// |     |     |     |     |     |   |  _  |  +  |  [  |  ]  |  \  |
//             | GUI |     | SPC |   | ENT |     | ALT |
                        bindings = <
   &kp EXCL  &kp AT    &kp HASH  &kp DLLR  &kp PRCNT   &kp CARET &kp AMPS  &kp ASTRK &kp LPAR &kp RPAR
   &trans    &trans    &trans    &trans    &trans      &kp MINUS &kp EQUAL &kp LBKT  &kp RBKT &kp PIPE
   &trans    &trans    &trans    &trans    &trans      &trans    &trans    &trans    &trans   &kp BSLH
                       &kp LGUI  &trans    &kp SPACE   &kp RET   &trans    &kp RALT
                        >;
                };

// This layer is unreachable until "tri layer state" is sorted out.
// Leaving it here for completeness.
                num_layer {
                        display-name = "Num Layer";
// -----------------------------------------------------------------------------------------
// |     |     |     |     |     |   |  A  |  7  |  8  |  9  |  D  |
// |     |     |     |     |     |   |  B  |  4  |  5  |  6  |  E  |
// |     |     |     |     |     |   |  C  |  1  |  2  |  3  |  F  |
//             |     |     |     |   |  0  |  .  |     |
                        bindings = <
   &trans &trans &trans &trans &trans    &kp A  &kp N7  &kp N8 &kp N9 &kp D
   &trans &trans &trans &trans &trans    &kp B  &kp N4  &kp N5 &kp N6 &kp E
   &trans &trans &trans &trans &trans    &kp C  &kp N1  &kp N2 &kp N3 &kp F
                 &trans &trans &trans    &kp N0 &kp DOT &trans
                        >;
                };
        };
};
