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

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

// Create new application (public repo)
async function createPublic(host_url, token, data) {
  const client = new CoolifyClient(host_url, token);
  return client.post('/api/v1/applications/public', data);
}

// Create new application (private GitHub app)
async function createPrivateGithubApp(host_url, token, data) {
  const client = new CoolifyClient(host_url, token);
  return client.post('/api/v1/applications/private-github-app', data);
}

// Create new application (private deploy key)
async function createPrivateDeployKey(host_url, token, data) {
  const client = new CoolifyClient(host_url, token);
  return client.post('/api/v1/applications/private-deploy-key', data);
}

// Dockerfile, Dockerimage, Dockercompose, etc.
async function dockerfile(host_url, token, data) {
  const client = new CoolifyClient(host_url, token);
  return client.post('/api/v1/applications/dockerfile', data);
}
async function dockerimage(host_url, token, data) {
  const client = new CoolifyClient(host_url, token);
  return client.post('/api/v1/applications/dockerimage', data);
}
async function dockercompose(host_url, token, data) {
  const client = new CoolifyClient(host_url, token);
  return client.post('/api/v1/applications/dockercompose', data);
}

module.exports = {
  list,
  createPublic,
  createPrivateGithubApp,
  createPrivateDeployKey,
  dockerfile,
  dockerimage,
  dockercompose,
}; 