import {
  applySliceAllHosts,
  applySliceHost,
  buildSliceApplyScript,
  buildSliceVerifyLines,
  sliceDescriptor,
  sliceUnitBody,
} from "./systemd-slice.mjs";

export const AGENT_SEAT_SLICE = "agent-seat.slice";

export const AGENT_SEAT_SLICE_DESCRIPTOR = sliceDescriptor({
  unit: AGENT_SEAT_SLICE,
  label: "agent-seat-slice",
  show: {
    MemoryMax: "17179869184",
    MemorySwapMax: "2147483648",
    CPUQuotaPerSecUSec: "7s",
    CPUWeight: "1",
    TasksMax: "512",
  },
});

export const AGENT_SEAT_SLICE_SRC_REL = AGENT_SEAT_SLICE_DESCRIPTOR.srcRel;
export const AGENT_SEAT_SLICE_DST_REL = AGENT_SEAT_SLICE_DESCRIPTOR.dstRel;
export const AGENT_SEAT_SLICE_REPO_PATH = AGENT_SEAT_SLICE_DESCRIPTOR.repoPath;
export const AGENT_SEAT_SLICE_SHOW = AGENT_SEAT_SLICE_DESCRIPTOR.show;

export function agentSeatSliceUnitBody(path = AGENT_SEAT_SLICE_REPO_PATH) {
  return sliceUnitBody(AGENT_SEAT_SLICE_DESCRIPTOR, path);
}

export function buildAgentSeatSliceVerifyLines(opts = {}) {
  return buildSliceVerifyLines(AGENT_SEAT_SLICE_DESCRIPTOR, opts);
}

export function buildAgentSeatSliceApplyScript() {
  return buildSliceApplyScript(AGENT_SEAT_SLICE_DESCRIPTOR);
}

export function applyAgentSeatSliceHost(cfg, deps = {}) {
  return applySliceHost(AGENT_SEAT_SLICE_DESCRIPTOR, cfg, deps);
}

export function applyAgentSeatSliceAllHosts(cfg, opts = {}, deps = {}) {
  return applySliceAllHosts(AGENT_SEAT_SLICE_DESCRIPTOR, cfg, opts, deps);
}
