{ config, lib, ... }:

with lib;

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

  config = mkIf cfg.enable {
    services.podman.containers.uptime-kuma = {
      image = "louislam/uptime-kuma:beta";
      network = "proxy";
      volumes = [
        "%h/containers/uptime-kuma/data:/app/data" 
      ];
    };

    settings.containers.caddy.routes.tbmrs.routes.uptime-kuma = {
      host = "uptime";
      url = "uptime-kuma:3001"; 
    };
  };
}
