const CoolifyClient = require('./coolifyClient');

async function health(host_url, token) {
  const client = new CoolifyClient(host_url, token);
  return client.get('/api/v1/health');
}

async function version(host_url, token) {
  const client = new CoolifyClient(host_url, token);
  return client.get('/api/v1/version');
}

async function listApps(host_url, token) {
  const client = new CoolifyClient(host_url, token);
  return client.get('/api/v1/applications');
}

async function startApp(host_url, token, id) {
  const client = new CoolifyClient(host_url, token);
  return client.post(`/api/v1/applications/${id}/start`, {});
}

async function stopApp(host_url, token, id) {
  const client = new CoolifyClient(host_url, token);
  return client.post(`/api/v1/applications/${id}/stop`, {});
}

module.exports = {
  health,
  version,
  listApps,
  startApp,
  stopApp,
};

