// Private AI South Africa — Local AI pricing and recommendation data.
// Keep volatile prices here so the public guide can be refreshed without
// rewriting page components.

const LOCAL_AI_LAST_VERIFIED = '17 July 2026';

const LOCAL_AI_TIERS = [
  {
    id: 'private-office',
    num: '01',
    label: 'Private office',
    name: 'Private Office Node',
    infrastructureCost: 'R60k–R85k',
    hardwareCost: 'R46k–R53k base hardware',
    hardware: 'Mac mini M4 Pro · 64GB unified memory',
    capacity: '64GB',
    power: 'Low draw',
    users: '1–5 users',
    modelClass: '35B-class Q4 text models',
    summary: 'A quiet, low-power node for private document search, drafting and internal knowledge work in a small office or branch.',
    bestFor: ['Legal and accounting', 'Consulting teams', 'Private document assistants'],
  },
  {
    id: 'team-appliance',
    num: '02',
    label: 'Team appliance',
    name: 'Team AI Appliance',
    infrastructureCost: 'R130k–R175k',
    hardwareCost: 'R104,999 base hardware',
    hardware: 'NVIDIA DGX Spark · 128GB unified memory · 4TB',
    capacity: '128GB',
    power: 'Efficient',
    users: '3–15 users',
    modelClass: 'Large local models and NVIDIA AI tooling',
    summary: 'A compact Linux and NVIDIA appliance for shared private AI, larger models, prototyping, data science and edge-development work.',
    bestFor: ['Clinics and universities', 'Operations knowledge', 'AI and edge development'],
  },
  {
    id: 'throughput',
    num: '03',
    label: 'Throughput',
    name: 'Throughput Workstation',
    infrastructureCost: 'R150k–R220k',
    hardwareCost: 'R64k–R75k GPU budget',
    hardware: 'NVIDIA GeForce RTX 5090 · 32GB VRAM',
    capacity: '32GB VRAM',
    power: 'High draw',
    users: '5–30 users',
    modelClass: 'Fast small-to-medium models, voice and image',
    summary: 'The speed-first option for classification, customer support, transcription, image generation and other high-volume workloads.',
    bestFor: ['Contact centres', 'Customer operations', 'Media and engineering'],
  },
  {
    id: 'enterprise',
    num: '04',
    label: 'Enterprise',
    name: 'Enterprise AI Node',
    infrastructureCost: 'R360k–R550k',
    hardwareCost: 'R243,999 GPU budget',
    hardware: 'NVIDIA RTX PRO 6000 Blackwell · 96GB ECC',
    capacity: '96GB ECC',
    power: 'High draw',
    users: 'Shared service',
    modelClass: 'Large models, controlled concurrency and ECC',
    summary: 'A governed workstation or server node when larger VRAM, ECC memory, warranty coverage and controlled multi-user inference justify the premium.',
    bestFor: ['Banks and insurers', 'Government and SOEs', 'Regulated enterprise'],
  },
];

const PRIVATE_AI_HIGHLIGHTS = [
  {
    num: '01',
    label: 'Controlled boundary',
    value: 'Approved models, documents and integrations run on infrastructure your organisation controls.',
  },
  {
    num: '02',
    label: 'South African budgets',
    value: 'Four infrastructure starting points span R60k to R550k before AT professional services.',
  },
  {
    num: '03',
    label: 'Workload-fit compute',
    value: 'Choose memory for larger text models or GPU throughput for voice, image and repeat processing.',
  },
  {
    num: '04',
    label: 'Operational by design',
    value: 'Power resilience, identity, audit, backups and human review are planned with the machine.',
  },
];

const PRIVATE_AI_RUN_PROFILES = [
  {
    id: 'documents',
    label: 'Private documents',
    prompt: 'Search, drafting and cited answers across a bounded private corpus.',
    tierId: 'private-office',
    modelClass: '20B–35B quantised text model',
    rationale: 'Prioritise usable memory, quiet operation and straightforward administration over maximum token throughput.',
    operatingCheck: 'Matter-level permissions, source citations and human approval.',
  },
  {
    id: 'shared-knowledge',
    label: 'Shared team knowledge',
    prompt: 'A multi-user assistant, research environment or internal knowledge service.',
    tierId: 'team-appliance',
    modelClass: '35B–70B quantised or mixture-of-experts model',
    rationale: 'The larger shared-memory pool gives a team room to test more capable models and NVIDIA tooling on one appliance.',
    operatingCheck: 'Identity, concurrency tests, retrieval evaluation and a named service owner.',
  },
  {
    id: 'throughput-work',
    label: 'Voice, image + volume',
    prompt: 'Transcription, classification, image generation or repeat customer-support tasks.',
    tierId: 'throughput',
    modelClass: '9B–27B fast model plus specialised media pipelines',
    rationale: 'A high-throughput GPU is more valuable here than fitting the largest possible text model into memory.',
    operatingCheck: 'Queue limits, escalation paths, quality thresholds and power capacity.',
  },
  {
    id: 'governed-service',
    label: 'Governed enterprise service',
    prompt: 'Controlled multi-user inference for regulated or operationally critical workflows.',
    tierId: 'enterprise',
    modelClass: '70B–120B quantised model with controlled concurrency',
    rationale: 'ECC capacity and an enterprise host support larger models, stronger isolation and an operational service boundary.',
    operatingCheck: 'SSO, audit logging, network isolation, backups and formal accountability.',
  },
];

// Condensed Pareto-frontier benchmark points sourced from local.ai on the
// verification date below. These are measured source values, not AT estimates.
// South African infrastructure budgets remain in LOCAL_AI_TIERS above.
const PRIVATE_AI_BENCHMARKS = {
  attributionLabel: 'local.ai',
  attributionUrl: 'https://local.ai/#intelligence-speed-frontier',
  retrieved: '17 July 2026',
  intelligenceFormula: '100 × (0.10 × τ²-bench + 0.35 × GAIA + 0.55 × GDPval)',
  taskSpeedFormula: '3,600 ÷ measured task time',
  valueFormula: '10,000,000 × 2^(intelligence ÷ 10) ÷ (task time × ZAR hardware price)',
  priceFallbackFormula: 'USD source price × 1.15 VAT × 1.25 AT margin × R18/USD',
  tiers: {
    'private-office': {
      hardwareId: 'm4_pro_64_20c',
      hardwareName: 'Mac mini M4 Pro 64GB · 20-core GPU',
      shortName: 'M4 Pro 64GB',
      imagePath: 'assets/private-ai/m4-pro-mac-mini.png',
      imageAlt: 'Mac mini M4 Pro hardware',
      imageScale: 0.82,
      priceUsd: 2250,
      localPriceZar: 49500,
      localPriceLabel: 'R46k–R53k',
      memoryGb: 64,
      measuredSweeps: 43,
      modelIdentities: 43,
      frontier: [
        { model: 'gemma-4-e2b-q4kxl', quant: 'q4kxl', intelligence: 17.6, taskSeconds: 45.7, tasksPerHour: 78.8 },
        { model: 'gemma-4-e2b-q8kxl', quant: 'q8kxl', intelligence: 17.9, taskSeconds: 59.6, tasksPerHour: 60.4 },
        { model: 'gemma-4-e4b-q4km', quant: 'q4km', intelligence: 22.8, taskSeconds: 72.6, tasksPerHour: 49.6 },
        { model: 'holo-3.1-35b-a3b-q4km', quant: 'q4km', intelligence: 59.1, taskSeconds: 211.5, tasksPerHour: 17.0 },
        { model: 'ornith-1.0-35b-q4km', quant: 'q4km', intelligence: 72.7, taskSeconds: 241.1, tasksPerHour: 14.9 },
        { model: 'qwen3.6-27b-mtp-q4km', quant: 'q4km', intelligence: 73.1, taskSeconds: 1542.0, tasksPerHour: 2.3 },
      ],
    },
    'team-appliance': {
      hardwareId: 'gb10_121',
      hardwareName: 'NVIDIA DGX Spark 128GB',
      shortName: 'DGX Spark',
      imagePath: 'assets/private-ai/dgx-spark-single.png',
      imageAlt: 'NVIDIA DGX Spark hardware',
      imageScale: 1.08,
      priceUsd: 4699,
      localPriceZar: 104999,
      localPriceLabel: 'R104,999',
      memoryGb: 128,
      measuredSweeps: 291,
      modelIdentities: 103,
      frontier: [
        { model: 'gemma-4-e2b-q4kxl', quant: 'q4kxl', intelligence: 17.6, taskSeconds: 31.4, tasksPerHour: 114.5 },
        { model: 'gemma-4-e4b-q4km', quant: 'q4km', intelligence: 22.8, taskSeconds: 57.0, tasksPerHour: 63.2 },
        { model: 'gemma-4-E4B-it-FP8-Dynamic', quant: 'fp8', intelligence: 24.4, taskSeconds: 91.8, tasksPerHour: 39.2 },
        { model: 'Holo-3.1-35B-A3B-NVFP4', quant: 'nvfp4', intelligence: 61.0, taskSeconds: 131.9, tasksPerHour: 27.3 },
        { model: 'Qwen3.6-35B-A3B-NVFP4', quant: 'nvfp4', intelligence: 74.1, taskSeconds: 232.9, tasksPerHour: 15.5 },
        { model: 'Qwen3.6-35B-A3B-FP8', quant: 'fp8', intelligence: 74.4, taskSeconds: 298.0, tasksPerHour: 12.1 },
        { model: 'Qwen3.6-35B-A3B', quant: '', intelligence: 75.5, taskSeconds: 514.6, tasksPerHour: 7.0 },
        { model: 'step-3.7-flash-iq4xs', quant: 'iq4xs', intelligence: 75.6, taskSeconds: 605.9, tasksPerHour: 5.9 },
        { model: 'Step-3.7-Flash-148B', quant: '', intelligence: 78.8, taskSeconds: 896.4, tasksPerHour: 4.0 },
      ],
    },
    throughput: {
      hardwareId: 'rtx5090_32',
      hardwareName: 'NVIDIA GeForce RTX 5090 32GB',
      shortName: 'RTX 5090',
      imagePath: 'assets/private-ai/rtx-5090.png',
      imageAlt: 'NVIDIA GeForce RTX 5090 graphics card',
      imageScale: 1.04,
      priceUsd: 3600,
      localPriceZar: 69500,
      localPriceLabel: 'R64k–R75k',
      memoryGb: 32,
      measuredSweeps: 54,
      modelIdentities: 27,
      frontier: [
        { model: 'LFM2.5-8B-A1B', quant: '', intelligence: 14.6, taskSeconds: 7.1, tasksPerHour: 509.7 },
        { model: 'gemma-4-e2b-q4kxl', quant: 'q4kxl', intelligence: 17.6, taskSeconds: 9.3, tasksPerHour: 388.2 },
        { model: 'gemma-4-e2b-q8kxl', quant: 'q8kxl', intelligence: 17.9, taskSeconds: 12.0, tasksPerHour: 299.6 },
        { model: 'gemma-4-e4b-q4km', quant: 'q4km', intelligence: 22.8, taskSeconds: 13.8, tasksPerHour: 260.7 },
        { model: 'gemma-4-E4B-it-FP8-Dynamic', quant: 'fp8', intelligence: 24.4, taskSeconds: 17.9, tasksPerHour: 201.3 },
        { model: 'gpt-oss-20b', quant: '', intelligence: 43.4, taskSeconds: 32.5, tasksPerHour: 110.8 },
        { model: 'Gemma-4-26B-A4B-NVFP4', quant: 'nvfp4', intelligence: 63.0, taskSeconds: 67.5, tasksPerHour: 53.3 },
        { model: 'gemma-4-31b-q4km', quant: 'q4km', intelligence: 65.6, taskSeconds: 82.3, tasksPerHour: 43.7 },
      ],
    },
    enterprise: {
      hardwareId: 'rtxpro6000_96',
      hardwareName: 'NVIDIA RTX PRO 6000 Blackwell 96GB',
      shortName: 'RTX PRO 6000',
      imagePath: 'assets/private-ai/rtx-pro-6000.png',
      imageAlt: 'NVIDIA RTX PRO 6000 Blackwell graphics card',
      imageScale: 1.04,
      priceUsd: 13250,
      localPriceZar: 243999,
      localPriceLabel: 'R243,999',
      memoryGb: 96,
      measuredSweeps: 122,
      modelIdentities: 66,
      frontier: [
        { model: 'Laguna-XS-2.1-NVFP4', quant: 'nvfp4', intelligence: 1.7, taskSeconds: 6.7, tasksPerHour: 540.5 },
        { model: 'gemma-4-e2b-q4kxl', quant: 'q4kxl', intelligence: 17.6, taskSeconds: 10.4, tasksPerHour: 346.3 },
        { model: 'Qwen3.5-9B-AWQ-4bit', quant: 'awq-4bit', intelligence: 43.2, taskSeconds: 28.9, tasksPerHour: 124.7 },
        { model: 'gpt-oss-20b', quant: '', intelligence: 43.4, taskSeconds: 32.1, tasksPerHour: 112.2 },
        { model: 'holo-3.1-35b-a3b-q4km', quant: 'q4km', intelligence: 59.1, taskSeconds: 36.3, tasksPerHour: 99.2 },
        { model: 'ornith-1.0-35b-q4km', quant: 'q4km', intelligence: 72.7, taskSeconds: 44.3, tasksPerHour: 81.3 },
        { model: 'Qwen3.6-35B-A3B-NVFP4', quant: 'nvfp4', intelligence: 74.1, taskSeconds: 53.0, tasksPerHour: 67.9 },
        { model: 'Qwen3.6-35B-A3B-FP8', quant: 'fp8', intelligence: 74.4, taskSeconds: 64.1, tasksPerHour: 56.2 },
        { model: 'Qwen3.6-35B-A3B', quant: '', intelligence: 75.5, taskSeconds: 91.3, tasksPerHour: 39.4 },
        { model: 'Qwen3.6-27B-NVFP4', quant: 'nvfp4', intelligence: 76.4, taskSeconds: 156.9, tasksPerHour: 22.9 },
      ],
    },
  },
};

const LOCAL_AI_INDUSTRIES = [
  {
    id: 'legal',
    label: 'Legal + finance',
    icon: 'shield',
    tierId: 'private-office',
    infrastructureBudget: 'R60k–R85k',
    workload: 'Contracts, policies, private document search, drafting and cited internal answers.',
    reason: 'Unified memory accommodates capable quantised text models without the noise, power and administration of a GPU tower.',
    safeguard: 'Human approval, matter-level permissions, source citations and auditable document versions.',
  },
  {
    id: 'health',
    label: 'Healthcare',
    icon: 'signal',
    tierId: 'team-appliance',
    infrastructureBudget: 'R140k–R180k',
    workload: 'Local transcription, administrative assistance and retrieval across approved clinical documentation.',
    reason: 'A shared appliance keeps sensitive workloads close to the practice while supporting larger local models and voice tooling.',
    safeguard: 'No autonomous diagnosis; encrypt records, restrict roles and keep a qualified person responsible for every clinical decision.',
  },
  {
    id: 'retail',
    label: 'Retail + support',
    icon: 'users',
    tierId: 'throughput',
    infrastructureBudget: 'R170k–R250k',
    workload: 'Customer-service retrieval, product matching, call transcription and repeat classification at volume.',
    reason: 'The workload benefits more from fast small-to-medium models and accelerated voice processing than from maximum model size.',
    safeguard: 'Confidence thresholds, escalation paths, transcript retention rules and continuous answer-quality evaluation.',
  },
  {
    id: 'industry',
    label: 'Industry + field',
    icon: 'cube',
    tierId: 'team-appliance',
    infrastructureBudget: 'R150k–R300k',
    workload: 'Maintenance knowledge, field guidance, computer-vision development and offline operational assistance.',
    reason: 'NVIDIA tooling and 128GB memory make the appliance a useful development hub before workloads move to dedicated edge devices.',
    safeguard: 'Keep safety-critical control outside the language model and validate every edge workflow under real field conditions.',
  },
  {
    id: 'creative',
    label: 'Media + engineering',
    icon: 'spatial',
    tierId: 'throughput',
    infrastructureBudget: 'R150k–R220k',
    workload: 'Creative agents, transcription, image generation, media processing and engineering knowledge assistance.',
    reason: 'A CUDA workstation offers the broadest compatibility for image, video, voice and accelerated production tooling.',
    safeguard: 'Track source rights, generated-asset provenance, client confidentiality and model licensing.',
  },
  {
    id: 'education',
    label: 'Education + research',
    icon: 'grow',
    tierId: 'team-appliance',
    infrastructureBudget: 'R140k–R450k',
    workload: 'Shared AI teaching, coding assistance, research experiments and private institutional knowledge.',
    reason: 'One shared appliance can serve a pilot lab; additional private-office nodes can expand hands-on access later.',
    safeguard: 'Test student-facing accuracy, disclose AI use and preserve academic assessment integrity.',
  },
  {
    id: 'regulated',
    label: 'Regulated enterprise',
    icon: 'terminal',
    tierId: 'enterprise',
    infrastructureBudget: 'R360k–R550k',
    workload: 'Controlled multi-user inference, larger private models and audited knowledge workflows.',
    reason: 'ECC VRAM, enterprise-class capacity and a governed host are appropriate when the service becomes operational infrastructure.',
    safeguard: 'POPIA-aligned purpose controls, SSO, audit logging, network isolation, tested backups and a formal operating owner.',
  },
];

const localAiTierById = (id) => LOCAL_AI_TIERS.find((tier) => tier.id === id);

Object.assign(window, {
  LOCAL_AI_LAST_VERIFIED,
  LOCAL_AI_TIERS,
  PRIVATE_AI_HIGHLIGHTS,
  PRIVATE_AI_RUN_PROFILES,
  PRIVATE_AI_BENCHMARKS,
  LOCAL_AI_INDUSTRIES,
  localAiTierById,
});
