{
  lib,
  config,
  namespace,
  ...
}:
with lib;
let
  inherit (lib.${namespace}) mkOpt;
  name = "orca-slicer";
  cfg = config.${namespace}.services.${name};

  orcaConfig = lib.${namespace}.mkModule {
    inherit config name;
    serviceName = "podman-${name}";
    description = "orca slicer web ui";
    options = {
      httpsPort = mkOpt types.int 443 "HTTPS port";
    };
    moduleConfig = {
      virtualisation.oci-containers.containers."${name}" = {
        autoStart = true;
        image = "linuxserver/orcaslicer";
        ports = [
          "${toString cfg.port}:3000"
          "${toString cfg.httpsPort}:3001"
        ];
        volumes = [ "${cfg.configDir}/orca-slicer:/config" ];
        environment = {
          PUID = cfg.puid;
          PGID = cfg.pgid;
          TZ = cfg.timeZone;
        };
      };
    };
  };
in
{
  imports = [ orcaConfig ];
}
