/**
 * Provider registry — maps provider name to API client module.
 * All providers expose the same interface: searchPacks, getPackDetails,
 * listVersions, getDownloadUrl.
 */

const curseforge = require('./curseforge');
const modrinth = require('./modrinth');
const ftb = require('./ftb');

const providers = {
  curseforge,
  modrinth,
  ftb,
  atlauncher: ftb,     // stub — shares FTB stub
  technic: ftb,        // stub
  voidswrath: ftb      // stub
};

function getProvider(name) {
  return providers[(name || '').toLowerCase()] || null;
}

function listProviders() {
  return [
    { id: 'curseforge',  name: 'CurseForge',  active: true },
    { id: 'modrinth',    name: 'Modrinth',     active: true },
    { id: 'ftb',         name: 'FTB',          active: false },
    { id: 'atlauncher',  name: 'ATLauncher',   active: false },
    { id: 'technic',     name: 'Technic',      active: false },
    { id: 'voidswrath',  name: 'VoidsWrath',   active: false }
  ];
}

module.exports = { getProvider, listProviders };
