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

/**
 * Deploy resources by tag or uuid (see OpenAPI for params).
 * @param {string} host_url
 * @param {string} token
 * @param {Object} data - Parameters for deployment.
 * @param {string} [data.tag] - Tag name(s). Comma separated list is also accepted.
 * @param {string} [data.uuid] - Resource UUID(s). Comma separated list is also accepted.
 * @param {boolean} [data.force] - Force rebuild (without cache).
 * @returns {Promise<Object>}
 * @example
 * deploy('https://coolify.example.com', 'TOKEN', { tag: 'v1.0.0', force: true });
 */
async function deploy(host_url, token, data) {
  const client = new CoolifyClient(host_url, token);
  return client.get('/api/v1/deploy', { params: data });
}

module.exports = {
  deploy,
};
