/**
 * Gatavase SEO keyword engine.
 *
 * A single registry of 300+ keywords grouped into clusters. Each page pulls the
 * clusters relevant to it, so pages get focused keyword coverage and internal
 * linking instead of one stuffed list repeated site-wide.
 */

export type KeywordCluster =
  | "ai"
  | "web"
  | "mobile"
  | "software"
  | "blockchain"
  | "cloud"
  | "security"
  | "network"
  | "design"
  | "training"
  | "robotics"
  | "media"
  | "impact"
  | "mobility"
  | "corporate"
  | "geo";

export const KEYWORD_CLUSTERS: Record<KeywordCluster, string[]> = {
  ai: [
    "AI company Uganda",
    "artificial intelligence Kampala",
    "custom AI models Africa",
    "machine learning development Uganda",
    "AI consulting Qatar",
    "generative AI development",
    "NLP development Africa",
    "computer vision solutions",
    "predictive analytics company",
    "AI chatbot development Uganda",
    "AI automation services",
    "document processing AI",
    "speech recognition Africa",
    "LLM integration services",
    "AI agents for business",
    "recommendation engine development",
    "fraud detection AI",
    "AI model deployment",
    "MLOps services Africa",
    "data labelling services Uganda",
    "AI strategy consulting Kampala",
    "conversational AI platform",
    "African language AI",
    "Luganda language model",
    "Arabic NLP services Doha",
  ],
  web: [
    "website development Uganda",
    "web design Kampala",
    "web development company Qatar",
    "ecommerce website Uganda",
    "corporate website design Africa",
    "React development company",
    "Next generation web platforms",
    "progressive web apps Uganda",
    "headless CMS development",
    "website redesign Kampala",
    "landing page development",
    "web portal development Africa",
    "booking system website",
    "school website development Uganda",
    "NGO website development",
    "website maintenance Kampala",
    "web hosting and deployment Uganda",
    "SEO friendly website development",
    "responsive web design Africa",
    "web accessibility services",
  ],
  mobile: [
    "mobile app development Uganda",
    "Android app developers Kampala",
    "iOS app development Africa",
    "cross platform app development",
    "React Native developers Uganda",
    "Flutter app development Africa",
    "fintech app development",
    "mobile money integration Uganda",
    "offline first mobile apps",
    "USSD application development",
    "delivery app development Kampala",
    "logistics app Uganda",
    "healthcare app development Africa",
    "agriculture app Uganda",
    "app maintenance and support",
    "mobile app UI design Africa",
    "app store publishing services",
    "low bandwidth mobile apps",
    "super app development",
    "mobile app security testing",
  ],
  software: [
    "enterprise software development Uganda",
    "custom software Kampala",
    "ERP development Africa",
    "CRM development Uganda",
    "HR management system Uganda",
    "inventory management software",
    "school management system Uganda",
    "hospital management software Africa",
    "point of sale software Kampala",
    "accounting software development",
    "API development services",
    "system integration Uganda",
    "legacy system modernisation",
    "SaaS product development Africa",
    "workflow automation software",
    "business intelligence dashboards",
    "data warehouse development",
    "software audit and consulting",
    "microservices architecture",
    "software QA and testing Uganda",
  ],
  blockchain: [
    "blockchain development Uganda",
    "smart contract development Africa",
    "solidity developers Kampala",
    "DeFi development company",
    "NFT platform development",
    "tokenisation platform Africa",
    "crypto wallet development",
    "blockchain supply chain Uganda",
    "web3 development Qatar",
    "digital asset registry",
    "blockchain land registry Africa",
    "smart contract audit",
    "stablecoin payment integration",
    "blockchain consulting Kampala",
    "distributed ledger solutions",
  ],
  cloud: [
    "cloud migration Uganda",
    "devops services Africa",
    "cloud architecture consulting",
    "kubernetes deployment Uganda",
    "serverless development Africa",
    "CI CD pipeline setup",
    "cloud cost optimisation",
    "database administration Uganda",
    "infrastructure as code",
    "disaster recovery planning Africa",
    "high availability systems",
    "cloud hosting Kampala",
    "multi region deployment",
    "system monitoring and observability",
    "platform engineering services",
  ],
  security: [
    "cybersecurity company Uganda",
    "penetration testing Kampala",
    "security audit Africa",
    "endpoint protection Uganda",
    "data protection compliance Africa",
    "secure software development",
    "identity and access management",
    "zero trust architecture",
    "incident response services",
    "vulnerability assessment Uganda",
    "encryption solutions Africa",
    "security awareness training",
    "SOC monitoring services",
    "device security management",
    "secure file sharing platform",
  ],
  network: [
    "network installation Uganda",
    "structured cabling Kampala",
    "office network setup Africa",
    "wifi installation Uganda",
    "fibre optic installation Kampala",
    "network security services",
    "server room setup Uganda",
    "CCTV installation Kampala",
    "VoIP phone systems Africa",
    "network troubleshooting Uganda",
    "LAN and WAN design",
    "campus network design Africa",
    "hotel network installation",
    "ISP setup consulting Uganda",
    "network maintenance contract",
  ],
  design: [
    "graphics design Uganda",
    "branding agency Kampala",
    "logo design Uganda",
    "corporate identity design Africa",
    "UI UX design Kampala",
    "product design services Africa",
    "motion graphics Uganda",
    "packaging design Kampala",
    "print design services Uganda",
    "social media graphics Africa",
    "brand guidelines development",
    "presentation design services",
    "signage design Uganda",
    "illustration services Africa",
    "3D visualisation Kampala",
  ],
  training: [
    "computer training Kampala",
    "IT training Uganda",
    "coding bootcamp Africa",
    "web development course Uganda",
    "data science training Kampala",
    "AI training Africa",
    "graphic design course Uganda",
    "networking certification training",
    "cybersecurity training Kampala",
    "digital skills training Uganda",
    "corporate IT training Africa",
    "Microsoft Office training Uganda",
    "software engineering internship Kampala",
    "youth tech training Uganda",
    "online IT courses Africa",
  ],
  robotics: [
    "robotics engineering Uganda",
    "automation engineering Africa",
    "industrial automation Kampala",
    "IoT development Uganda",
    "embedded systems Africa",
    "drone technology Uganda",
    "sensor networks Kampala",
    "PLC programming Africa",
    "smart agriculture technology Uganda",
    "robotics education Africa",
    "prototyping and hardware design",
    "machine vision inspection",
    "process automation Uganda",
    "smart building systems Kampala",
    "renewable energy monitoring",
  ],
  media: [
    "podcast production Uganda",
    "digital radio Africa",
    "music production Kampala",
    "African music distribution",
    "audio streaming platform Africa",
    "video production Uganda",
    "digital publishing Africa",
    "ebook platform Uganda",
    "content studio Kampala",
    "creative technology Africa",
    "media technology Uganda",
    "African storytelling platform",
    "live streaming services Kampala",
    "sound engineering Uganda",
    "artist management technology",
  ],
  impact: [
    "technology for social impact Africa",
    "NGO technology partner Uganda",
    "community development Kampala",
    "digital inclusion Africa",
    "youth empowerment Uganda",
    "education technology Africa",
    "healthcare technology Uganda",
    "charity foundation Kampala",
    "skills training for youth Africa",
    "rural connectivity Uganda",
    "social enterprise technology",
    "sustainable development technology",
    "community outreach Uganda",
    "scholarship programme Kampala",
    "faith based foundation Uganda",
  ],
  mobility: [
    "electric vehicles Uganda",
    "SUV distribution Africa",
    "fleet management technology",
    "vehicle telematics Uganda",
    "ride hailing platform Africa",
    "logistics technology Kampala",
    "delivery platform Uganda",
    "smart mobility Africa",
    "vehicle tracking Uganda",
    "transport technology Kampala",
    "EV charging infrastructure Africa",
    "automotive software Uganda",
    "last mile delivery technology",
    "driver app development",
    "mobility as a service Africa",
  ],
  corporate: [
    "Gatavase Corporation",
    "Gazman Advanced Technologies",
    "technology company Uganda",
    "IT company Kampala",
    "software company Doha",
    "technology partner Africa Middle East",
    "Kabogoza Fred Edwards",
    "tech careers Uganda",
    "software jobs Kampala",
    "technology consulting Africa",
    "digital transformation Uganda",
    "innovation hub Kampala",
    "R&D lab Africa",
    "enterprise technology partner Qatar",
    "African technology innovation",
  ],
  geo: [
    "Kampala",
    "Muyenga Bukasa",
    "Uganda technology",
    "East Africa software",
    "Doha",
    "Al Rayyan",
    "Qatar technology services",
    "Middle East software partner",
    "Africa software outsourcing",
    "Nairobi software partner",
    "Kigali technology services",
    "Dar es Salaam software",
    "Juba technology services",
    "Gulf region IT partner",
    "African software engineering talent",
  ],
};

/** Long-tail, buyer-intent phrases used across page copy and structured data. */
export const LONGTAIL_KEYWORDS: string[] = [
  "how much does a website cost in Uganda",
  "best software company in Kampala",
  "hire React developers in Uganda",
  "affordable mobile app developers Kampala",
  "custom ERP for Ugandan businesses",
  "mobile money API integration developer",
  "school management system price Uganda",
  "hospital software vendor Uganda",
  "SACCO management software Uganda",
  "microfinance core banking software Africa",
  "agritech software developers East Africa",
  "logistics tracking software Kampala",
  "AI consultant for Ugandan banks",
  "chatbot for customer support Uganda",
  "blockchain developer for hire Africa",
  "smart contract auditor East Africa",
  "cloud migration partner Qatar",
  "devops engineers for hire Doha",
  "cybersecurity assessment for SMEs Uganda",
  "penetration testing quote Kampala",
  "office wifi installation cost Kampala",
  "structured cabling contractor Uganda",
  "CCTV and access control installer Kampala",
  "branding agency for startups Uganda",
  "logo and brand identity package Kampala",
  "UI UX designer for hire Africa",
  "coding classes for beginners Kampala",
  "data analytics course in Uganda",
  "IT internship placement Kampala",
  "robotics club for schools Uganda",
  "IoT sensors for farms Uganda",
  "drone mapping services East Africa",
  "podcast studio hire Kampala",
  "music distribution for African artists",
  "ebook publishing platform Africa",
  "NGO donor reporting software Uganda",
  "charity website and donations Uganda",
  "electric SUV importer Uganda",
  "fleet tracking system Kampala",
  "secure messaging app for organisations Africa",
  "private search engine for enterprises",
  "enterprise browser for African businesses",
  "software development outsourcing to Uganda",
  "offshore engineering team East Africa",
  "technology partner for Gulf companies",
];

export const ALL_KEYWORDS: string[] = [
  ...Object.values(KEYWORD_CLUSTERS).flat(),
  ...LONGTAIL_KEYWORDS,
];

export function keywordsFor(clusters: KeywordCluster[], limit = 24): string[] {
  const seen = new Set<string>();
  const out: string[] = [];
  for (const cluster of clusters) {
    for (const keyword of KEYWORD_CLUSTERS[cluster] ?? []) {
      if (seen.has(keyword)) continue;
      seen.add(keyword);
      out.push(keyword);
      if (out.length >= limit) return out;
    }
  }
  return out;
}

export function keywordMeta(clusters: KeywordCluster[]) {
  return { name: "keywords", content: keywordsFor(clusters).join(", ") };
}
