{ config, lib, ... }:

let
  cfg = config.subs.sioyek;
in
{
  options.subs.sioyek.enable = lib.mkOption {
    default = false;
    type = lib.types.bool;
  };

  config = lib.mkIf cfg.enable {
    programs.sioyek = {
      enable = true;
      bindings = {
        "add_highlight" = "<unbound>";
        "overview_definition" = "<unbound>";
        "toggle_dark_mode" = "<unbound>";
        "fit_to_page_width" = "<unbound>";
        "quit" = "<unbound>";
        "next_page" = "l";
        "previous_page" = "h";
        "toggle_custom_color" = "i";
        "fit_to_page_width_ratio" = "=";
        "close_window" = "q";
      };
      config = {
        "ui_font" = "Inter";
        "font_size" = "15";
        "status_bar_font_size" = "10";
        "fit_to_page_width_ratio" = "1.0";
        "should_launch_new_window" = "1";
        "show_document_name_in_statusbar" = "1";
        "super_fast_search" = "1";
        "collapsed_toc" = "1";
        "sort_bookmarks_by_location" = "1";
        "create_table_of_contents_if_not_exists" = "0";
        "dark_mode_background_color" = "0.114 0.125 0.129";
        "custom_background_color" = "0.114 0.125 0.129";
        "startup_commands" = "fit_to_page_width_ratio,toggle_custom_color";
      };
    };
  };
}
