{ config, pkgs, lib, ... }:

let
  cfg = config.docs;
in
{
  imports = [ ./subs/sioyek.nix ];

  options.docs = {
    zathura.enable = lib.mkOption {
      default = true;
      type = lib.types.bool;
    };
    sioyek.enable = lib.mkOption {
      default = true;
      type = lib.types.bool;
    };
    libreoffice.enable = lib.mkOption {
      default = true;
      type = lib.types.bool;
    };
    foliate.enable = lib.mkOption {
      default = true;
      type = lib.types.bool;
    };
  };

  config = {
    subs.sioyek.enable = cfg.sioyek.enable;

    programs.zathura = {
      enable = cfg.zathura.enable;
      extraConfig = builtins.readFile ../config/zathurarc;
    };

    programs.foliate = {
      enable = cfg.foliate.enable;
    };

    home.packages = lib.mkIf cfg.libreoffice.enable [
      pkgs.libreoffice-fresh
    ];
  };
}
