// IVE Mobile — sample data layer
// Claims scored on two axes (Evidence Basis × Social Consensus), decayed
// against the half-life of their epistemic domain.

const DOMAINS = {
  mathematical: { label: 'Mathematical', halfLife: 36500, tint: '#23202B' },
  scientific:   { label: 'Scientific',   halfLife: 1825,  tint: '#1F3A3F' },
  historical:   { label: 'Historical',   halfLife: 7300,  tint: '#3A2A1F' },
  legal:        { label: 'Legal',        halfLife: 1460,  tint: '#2C2A3A' },
  journalistic: { label: 'Journalistic', halfLife: 180,   tint: '#2A2D1F' },
  philosophical:{ label: 'Philosophical',halfLife: 18250, tint: '#3A2A35' },
  aesthetic:    { label: 'Aesthetic',    halfLife: 3650,  tint: '#3A332A' },
};

const STATUS_LABEL = {
  verified: 'Verified', contested: 'Contested', disputed: 'Disputed',
  unsupported: 'Unsupported', opinion: 'Opinion', unverified: 'Unverified',
};

// Evidence-basis sub-weights and social-consensus sub-weights describe how a
// composite score was reached — surfaced when the reader scrubs the plane.
const CLAIMS = [
  {
    id: 'a3f1c8e2',
    claim: 'The 2026 IPCC AR7 finds anthropogenic warming has accelerated faster than previously modelled.',
    domain: 'scientific',
    status: 'verified',
    eb: 0.86, sc: 0.79,
    verifiedAt: '2026-04-12', ageDays: 49, decay: 0.92,
    sources: 14,
    summary: 'The Seventh Assessment Report consolidates 9 independent observational records. Three reconstruct the post-2015 acceleration directly; the remainder are consistent within stated uncertainty.',
    ebParts: [
      ['Primary sources', 0.91], ['Methodology', 0.88], ['Replication', 0.82], ['Source credibility', 0.84],
    ],
    scParts: [
      ['Expert consensus', 0.88], ['Cross-domain agreement', 0.74], ['Dissent weight', 0.71],
    ],
    evidence: [
      ['IPCC AR7 · WG1 Summary', 'ipcc.ch', 0.96, 'Primary · 2026'],
      ['Nature Climate Change · 14:221', 'nature.com', 0.91, 'Peer-reviewed · 2026'],
      ['NOAA Global Temp Record', 'noaa.gov', 0.89, 'Dataset · 2026'],
      ['Berkeley Earth reanalysis', 'berkeleyearth.org', 0.85, 'Dataset · 2025'],
    ],
    counter: [
      ['Satellite troposphere series show smaller trend', 'remss.com', 0.44, 'Methodological dissent'],
    ],
    provenance: [
      ['Submitted', '2026-04-09', 'reader · anon-7f2'],
      ['Auto-extracted · 3 claims', '2026-04-09', 'engine'],
      ['Assigned to scientific queue', '2026-04-10', 'engine'],
      ['Scored 0.86 / 0.79', '2026-04-12', 'verifier · K. Mbeki'],
      ['Verified', '2026-04-12', 'verifier · K. Mbeki'],
    ],
  },
  {
    id: 'b7d240a1',
    claim: "South Africa's screen sector contributed over R12bn to GDP in 2024.",
    domain: 'journalistic',
    status: 'verified',
    eb: 0.81, sc: 0.72,
    verifiedAt: '2026-05-02', ageDays: 29, decay: 0.69,
    sources: 9,
    summary: 'Figure traced to the NFVF economic impact study, corroborated by dtic incentive disbursement records. The journalistic half-life is short — this claim is approaching a recheck threshold.',
    ebParts: [['Primary sources', 0.84], ['Methodology', 0.78], ['Replication', 0.71], ['Source credibility', 0.86]],
    scParts: [['Expert consensus', 0.79], ['Cross-domain agreement', 0.68], ['Dissent weight', 0.66]],
    evidence: [
      ['NFVF Economic Impact Study 2024', 'nfvf.co.za', 0.9, 'Primary · 2024'],
      ['the dtic incentive report', 'thedtic.gov.za', 0.87, 'Government · 2025'],
      ['Stats SA cultural account', 'statssa.gov.za', 0.83, 'Dataset · 2024'],
    ],
    counter: [
      ['Methodology excludes informal production', 'analyst note', 0.4, 'Scope dissent'],
    ],
    provenance: [
      ['Submitted via URL', '2026-04-28', 'reader · anon-3a1'],
      ['Source quality preview · high', '2026-04-28', 'engine'],
      ['Scored 0.81 / 0.72', '2026-05-02', 'verifier · T. Naidoo'],
      ['Verified', '2026-05-02', 'verifier · T. Naidoo'],
    ],
  },
  {
    id: 'c1e9f730',
    claim: 'A four-day work week increases overall productivity without loss of output.',
    domain: 'scientific',
    status: 'contested',
    eb: 0.54, sc: 0.61,
    verifiedAt: '2026-03-20', ageDays: 72, decay: 0.86,
    sources: 11,
    summary: 'Trials report gains, but effect sizes vary widely by sector and most lack control groups. Strong public agreement outruns the strength of the evidence — a classic high-SC, mid-EB position.',
    ebParts: [['Primary sources', 0.58], ['Methodology', 0.46], ['Replication', 0.52], ['Source credibility', 0.61]],
    scParts: [['Expert consensus', 0.55], ['Cross-domain agreement', 0.6], ['Dissent weight', 0.68]],
    evidence: [
      ['4 Day Week Global · 2023 pilot', 'fourdayweek.com', 0.72, 'Trial · 2023'],
      ['Cambridge / Boston College report', 'bc.edu', 0.78, 'Peer-reviewed · 2023'],
    ],
    counter: [
      ['No randomised control in major trials', 'meta-review', 0.62, 'Methodological'],
      ['Self-selection of participating firms', 'analyst note', 0.55, 'Sampling bias'],
    ],
    provenance: [
      ['Submitted', '2026-03-14', 'reader · anon-9b8'],
      ['Scored 0.54 / 0.61', '2026-03-20', 'verifier · L. Okafor'],
      ['Marked contested', '2026-03-20', 'verifier · L. Okafor'],
      ['Appeal opened', '2026-03-25', 'reader · anon-2c4'],
    ],
  },
  {
    id: 'd4a8b612',
    claim: 'The Antikythera mechanism functioned as a general-purpose computer.',
    domain: 'historical',
    status: 'disputed',
    eb: 0.38, sc: 0.34,
    verifiedAt: '2026-02-11', ageDays: 109, decay: 0.99,
    sources: 7,
    summary: '"General-purpose" overstates the evidence. The device modelled astronomical cycles but is not Turing-general; the framing conflates analogue prediction with computation.',
    ebParts: [['Primary sources', 0.42], ['Methodology', 0.36], ['Replication', 0.3], ['Source credibility', 0.44]],
    scParts: [['Expert consensus', 0.3], ['Cross-domain agreement', 0.38], ['Dissent weight', 0.34]],
    evidence: [
      ['Freeth et al. · Nature 2021', 'nature.com', 0.88, 'Peer-reviewed · 2021'],
    ],
    counter: [
      ['Device is special-purpose analogue, not general', 'historian consensus', 0.81, 'Definitional'],
      ['No evidence of programmability', 'review', 0.74, 'Evidential'],
    ],
    provenance: [
      ['Submitted', '2026-02-08', 'reader · anon-5d2'],
      ['Scored 0.38 / 0.34', '2026-02-11', 'verifier · R. Adeyemi'],
      ['Marked disputed', '2026-02-11', 'verifier · R. Adeyemi'],
    ],
  },
  {
    id: 'e0c52d99',
    claim: 'There are infinitely many twin primes.',
    domain: 'mathematical',
    status: 'contested',
    eb: 0.47, sc: 0.81,
    verifiedAt: '2026-01-30', ageDays: 121, decay: 1.0,
    sources: 6,
    summary: 'An open conjecture. Belief among mathematicians is near-unanimous, but no proof exists — so evidence basis stays low while social consensus is high. Mathematics never decays.',
    ebParts: [['Primary sources', 0.4], ['Methodology', 0.5], ['Replication', 0.0], ['Source credibility', 0.9]],
    scParts: [['Expert consensus', 0.92], ['Cross-domain agreement', 0.7], ['Dissent weight', 0.8]],
    evidence: [
      ['Zhang · bounded gaps (2013)', 'annals.math', 0.95, 'Peer-reviewed · 2013'],
      ['Polymath8 project', 'polymathprojects.org', 0.82, 'Collaboration · 2014'],
    ],
    counter: [
      ['No proof of infinitude exists', 'open problem', 0.9, 'Definitional gap'],
    ],
    provenance: [
      ['Submitted', '2026-01-27', 'reader · anon-1f0'],
      ['Scored 0.47 / 0.81', '2026-01-30', 'verifier · S. Haddad'],
      ['Marked contested · open conjecture', '2026-01-30', 'verifier · S. Haddad'],
    ],
  },
  {
    id: 'f9b1c044',
    claim: 'Generative AI will eliminate more jobs than it creates by 2030.',
    domain: 'journalistic',
    status: 'unsupported',
    eb: 0.29, sc: 0.52,
    verifiedAt: '2026-05-18', ageDays: 13, decay: 0.95,
    sources: 5,
    summary: 'A prediction about the future cannot have an evidence basis yet. Projections diverge sharply; this is filed as forward-looking opinion, not a verifiable claim.',
    ebParts: [['Primary sources', 0.2], ['Methodology', 0.3], ['Replication', 0.1], ['Source credibility', 0.5]],
    scParts: [['Expert consensus', 0.44], ['Cross-domain agreement', 0.5], ['Dissent weight', 0.6]],
    evidence: [
      ['WEF Future of Jobs 2025', 'weforum.org', 0.7, 'Survey · 2025'],
    ],
    counter: [
      ['Net-employment projections are positive in 2 of 3 models', 'analyst note', 0.55, 'Forecast spread'],
      ['Future events are not yet evidence-bearing', 'engine policy', 0.8, 'Category'],
    ],
    provenance: [
      ['Submitted', '2026-05-15', 'reader · anon-8e3'],
      ['Flagged forward-looking', '2026-05-16', 'engine'],
      ['Scored 0.29 / 0.52', '2026-05-18', 'verifier · M. Dlamini'],
      ['Marked unsupported', '2026-05-18', 'verifier · M. Dlamini'],
    ],
  },
];

const FEED_TODAY = ['a3f1c8e2', 'f9b1c044', 'b7d240a1', 'c1e9f730'];
const SAVED_IDS  = ['c1e9f730', 'e0c52d99'];

const VERIFIER_QUEUE = [
  ['v1', 'The basic reproduction number of measles is between 12 and 18.', 'scientific', 'high'],
  ['v2', 'The Rome Statute entered into force on 1 July 2002.', 'legal', 'high'],
  ['v3', 'Load-shedding reduced South African GDP growth by 2pp in 2023.', 'journalistic', 'medium'],
];

const getClaim = (id) => CLAIMS.find((c) => c.id === id);

Object.assign(window, {
  DOMAINS, STATUS_LABEL, CLAIMS, FEED_TODAY, SAVED_IDS, VERIFIER_QUEUE, getClaim,
});
