{
  lib,
  config,
  namespace,
  ...
}:
with lib;
let
  cfg = config.${namespace}.services.free-games-claimer;
in
{
  imports = [ ./options.nix ];

  config = mkIf cfg.enable {
    virtualisation.oci-containers.containers."${cfg.name}" = {
      autoStart = cfg.autoStart;
      image = cfg.image;
      ports = [ "${cfg.httpPort}:6080" ];
      volumes = [ "${cfg.dataPath}:/fgc/data" ];
      environmentFiles = [ config.sops.templates."fgc.env".path ];
      environment = {
        PUID = cfg.puid;
        PGID = cfg.pgid;
        TZ = cfg.timeZone;
      };
    };
  };
}
