{ lib, ... }:

{
  programs.wezterm = {
    enable = true;
    settings = {
      color_scheme = "Catppuccin Mocha";
      font_size = 13;
      hide_tab_bar_if_only_one_tab = true;
      window_padding = {
        left = 0;
        right = 0;
        top = 0;
        bottom = 0;
      };
      keys = [
        {
          key = "F11";
          action = lib.generators.mkLuaInline "wezterm.action.ToggleFullScreen";
        }
        {
          key = "+";
          mods = "CTRL";
          action = lib.generators.mkLuaInline "wezterm.action.IncreaseFontSize";
        }
      ];
    };
  };

  nmt.script =
    let
      expectedConfig = builtins.toFile "wezterm.lua" ''
        -- Generated by Home Manager.
        -- See https://wezfurlong.org/wezterm/

        local wezterm = require 'wezterm'
        local config = wezterm.config_builder and wezterm.config_builder() or {}

        local hm_config = {
          ["color_scheme"] = "Catppuccin Mocha",
          ["font_size"] = 13,
          ["hide_tab_bar_if_only_one_tab"] = true,
          ["keys"] = {
            {
              ["action"] = (wezterm.action.ToggleFullScreen),
              ["key"] = "F11"
            },
            {
              ["action"] = (wezterm.action.IncreaseFontSize),
              ["key"] = "+",
              ["mods"] = "CTRL"
            }
          },
          ["window_padding"] = {
            ["bottom"] = 0,
            ["left"] = 0,
            ["right"] = 0,
            ["top"] = 0
          }
        }
        for k, v in pairs(hm_config) do
          config[k] = v
        end


        return config
      '';
    in
    ''
      assertFileExists home-files/.config/wezterm/wezterm.lua
      assertFileContent home-files/.config/wezterm/wezterm.lua ${expectedConfig}
    '';
}
