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

/**
 * List all teams.
 * @param {string} host_url
 * @param {string} token
 * @returns {Promise<Object[]>}
 * @example
 * list('https://coolify.example.com', 'TOKEN');
 */
async function list(host_url, token) {
  const client = new CoolifyClient(host_url, token);
  return client.get('/api/v1/teams');
}

/**
 * Get current team.
 * @param {string} host_url
 * @param {string} token
 * @returns {Promise<Object>}
 * @example
 * current('https://coolify.example.com', 'TOKEN');
 */
async function current(host_url, token) {
  const client = new CoolifyClient(host_url, token);
  return client.get('/api/v1/teams/current');
}

/**
 * List current team members.
 * @param {string} host_url
 * @param {string} token
 * @returns {Promise<Object[]>}
 * @example
 * currentMembers('https://coolify.example.com', 'TOKEN');
 */
async function currentMembers(host_url, token) {
  const client = new CoolifyClient(host_url, token);
  return client.get('/api/v1/teams/current/members');
}

module.exports = {
  list,
  current,
  currentMembers,
}; 