// ============================================================
// WASIED · Service Registry
// Single source of truth for all services.
// To add a new service: add an entry here + create its landing + app components.
// ============================================================

const SERVICES_REGISTRY = {
  hosting: {
    id: 'hosting',
    name: 'Hébergement',
    brandName: 'Wasied Hébergement',
    tagline: "Serveurs GMod & bots Discord.",
    icon: 'server',
    color: 'var(--service-hosting)',
    colorHex: '#67E8F9',
    status: 'live', // live | beta | soon
    marketing: {
      path: '/hosting',
      subNav: [
        { label: "Vue d'ensemble", path: '/hosting' },
        { label: 'Plans', path: '/hosting#plans' },
        { label: 'Hardware', path: '/hosting#hardware' },
        { label: 'Bots Discord', path: '/hosting#bots' },
        { label: 'FAQ', path: '/hosting#faq' },
      ],
      summary: "Hébergement haute performance pour serveurs Garry's Mod et bots Discord, sur machines EPYC, anti-DDoS, sauvegardes AWS.",
    },
    app: {
      rootPath: '/app/hosting',
      sidebarNav: [
        { icon: 'dashboard', label: "Vue d'ensemble", path: '/app/hosting' },
        { icon: 'server',    label: 'Mes serveurs',   path: '/app/hosting' },
      ],
    },
  },

  orders: {
    id: 'orders',
    name: 'Commandes',
    brandName: 'Wasied Commandes',
    tagline: "Développement custom à la commande.",
    icon: 'briefcase',
    color: 'var(--service-orders)',
    colorHex: '#6EE7A7',
    status: 'live',
    marketing: {
      path: '/orders',
      subNav: [
        { label: "Vue d'ensemble", path: '/orders' },
        { label: 'Process', path: '/orders#process' },
        { label: 'Portfolio', path: '/portfolio' },
        { label: 'Avis', path: '/orders#avis' },
      ],
      summary: "Addons GMod, gamemodes complets, sites web et bots Discord. 140+ commandes livrées avec un process en deux temps.",
    },
    app: {
      rootPath: '/app/orders',
      sidebarNav: [
        { icon: 'dashboard', label: "Vue d'ensemble", path: '/app/orders' },
        { icon: 'briefcase', label: 'Mes commandes',  path: '/app/orders' },
        { icon: 'plus',      label: 'Nouveau devis',  path: '/quote' },
      ],
    },
  },

  formations: {
    id: 'formations',
    name: 'Formations',
    brandName: 'Wasied Formations',
    tagline: "Devenir développeur GMod.",
    icon: 'graduation',
    color: 'var(--service-formations)',
    colorHex: '#C4B5FD',
    status: 'live',
    marketing: {
      path: '/formations',
      subNav: [
        { label: "Vue d'ensemble", path: '/formations' },
        { label: 'Programme', path: '/formations#curriculum' },
        { label: 'Packs', path: '/formations#tiers' },
        { label: 'Avis', path: '/formations#avis' },
      ],
      summary: "Formation #1 en France pour GLua. 12 chapitres, 87 modules, du débutant à l'expert. Garantie remboursement.",
    },
    app: {
      rootPath: '/app/formations',
      sidebarNav: [
        { icon: 'dashboard',  label: "Vue d'ensemble", path: '/app/formations' },
        { icon: 'play',       label: 'Reprendre',      path: '/app/formations/glua-mastery' },
        { icon: 'calendar',   label: 'Rendez-vous 1:1', path: '/app/formations#rdv' },
        { icon: 'award',      label: 'Mon certificat', path: '/app/formations#cert' },
      ],
    },
  },

  addons: {
    id: 'addons',
    name: 'Addons',
    brandName: 'Wasied Addons',
    tagline: "Catalogue d'addons GMod.",
    icon: 'package',
    color: 'var(--service-addons)',
    colorHex: '#FBBF24',
    status: 'live',
    marketing: {
      path: '/addons',
      subNav: [
        { label: 'Catalogue', path: '/addons' },
        { label: 'Gratuits',  path: '/addons?filter=free' },
        { label: 'Premium',   path: '/addons?filter=paid' },
      ],
      summary: "Catalogue Wasied : ex-payants désormais offerts + nouveautés premium maintenues. Tags, recherche, fiche détail.",
    },
    app: {
      rootPath: '/app/addons',
      sidebarNav: [
        { icon: 'package',  label: 'Mes addons',      path: '/app/addons' },
        { icon: 'download', label: 'Téléchargements', path: '/app/addons#dl' },
      ],
    },
  },

  agents: {
    id: 'agents',
    name: 'Agents IA',
    brandName: 'Wasied Agents',
    tagline: "Agents IA pour serveurs GMod.",
    icon: 'spark',
    color: '#A78BFA',
    colorHex: '#A78BFA',
    status: 'soon',
    marketing: {
      path: '/agents',
      subNav: [
        { label: "Vue d'ensemble", path: '/agents' },
        { label: 'Bêta privée',    path: '/agents#beta' },
      ],
      summary: "Agents IA conversationnels et systèmes pour vos serveurs : NPCs intelligents, modération assistée, support joueurs automatisé. Bêta privée à venir.",
    },
    app: {
      rootPath: '/app/agents',
      sidebarNav: [
        { icon: 'spark', label: 'Bientôt disponible', path: '/app/agents' },
      ],
    },
  },
};

// Account-level navigation (cross-service, always shown in sidebar bottom)
const ACCOUNT_NAV = [
  { icon: 'euro',     label: 'Facturation',   path: '/app/billing' },
  { icon: 'ticket',   label: 'Support',       path: '/app/support' },
  { icon: 'star',     label: 'Affiliation',   path: '/app/affiliate' },
  { icon: 'settings', label: 'Paramètres',    path: '/app/settings' },
];

// Helper: detect current service from a path
function serviceFromPath(path) {
  for (const s of Object.values(SERVICES_REGISTRY)) {
    if (path === s.app.rootPath || path.startsWith(s.app.rootPath + '/')) return s;
    if (path === s.marketing.path || path.startsWith(s.marketing.path + '/')) return s;
  }
  return null;
}

// Helper: services in display order
function listServices() {
  return Object.values(SERVICES_REGISTRY);
}

Object.assign(window, { SERVICES_REGISTRY, ACCOUNT_NAV, serviceFromPath, listServices });
