{ config, lib, ... }:

with lib;

let
  cfg = config.settings.containers.vikunja;
in {
  options = {
    settings.containers.vikunja.enable = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Enable vikunja container
      '';
    };
  };

  config = mkIf cfg.enable {
    services.podman.containers.vikunja = {
      image = "vikunja/vikunja";
      network = "proxy";
      userNS = "keep-id";
      volumes = [
        "%h/containers/vikunja/files:/app/vikunja/files" 
        "%h/containers/vikunja/db:/db" 
      ];
    };

    settings.containers.caddy.routes.tbmrs-local.routes.vikunja = {
      host = "tasks";
      url = "vikunja:3456"; 
    };
  };
}
