// Canned dataset for the sortof prototype. Faked but plausible PZ mods.
// Used to drive the various states deterministically.

const SAMPLE_INPUT = `2169435993
2392709985
2487022075
2685168362
2784607980
1299328280
2865072321
2566953935
2200148440
2503622437
2702991010`;

const SAMPLE_RULES = `# sorting_rules.txt
# pin libraries first; map packs last
load_first: tsarslib, modoptions, BB_CommonLib
load_last:  Muldraugh_KY, BedfordFalls, Eerie_County
incompatible: BetterFlashlight | RealisticFlashlight
require: TMC_TrueActions => tsarslib
`;

// id, workshopId, modId, name, category (lib|map|gameplay|qol|content), deps, conflictsWith, loadFirst, loadLast
const MOD_DB = [
  { wsid: '2169435993', modId: 'modoptions',       name: 'Mod Options',          cat: 'lib',      deps: [], pos: 'first' },
  { wsid: '2392709985', modId: 'tsarslib',         name: "Tsar's Common Library", cat: 'lib',     deps: [], pos: 'first' },
  { wsid: '2487022075', modId: 'TMC_TrueActions',  name: 'True Actions',         cat: 'gameplay', deps: ['tsarslib'], pos: '' },
  { wsid: '2685168362', modId: 'BB_CommonLib',     name: 'BB Common Library',    cat: 'lib',      deps: [], pos: 'first' },
  { wsid: '2784607980', modId: 'BetterFlashlight', name: 'Better Flashlight',    cat: 'qol',      deps: ['modoptions'], pos: '', conflicts: ['RealisticFlashlight'] },
  { wsid: '1299328280', modId: 'ORGM',             name: 'ORGM Rechambered',     cat: 'content',  deps: [] },
  { wsid: '2865072321', modId: 'Brita_Weapons',    name: 'Brita\u2019s Weapon Pack', cat: 'content', deps: ['Brita_Armor'] }, // missing dep
  { wsid: '2566953935', modId: 'autotsar_trailers', name: 'Autotsar Trailers',   cat: 'content',  deps: ['tsarslib'] },
  { wsid: '2200148440', modId: 'Eerie_County',     name: 'Eerie County',         cat: 'map',      deps: ['Muldraugh_KY'], pos: 'last' },
  { wsid: '2503622437', modId: 'BedfordFalls',     name: 'Bedford Falls',        cat: 'map',      deps: [], pos: 'last' },
  { wsid: '2702991010', modId: 'Muldraugh_KY',     name: 'Muldraugh, KY',        cat: 'map',      deps: [], pos: 'last', isMap: true, mapName: 'Muldraugh, KY' },
];

// Sorted output (per faked sorting rules)
const SORTED_ORDER = [
  'modoptions', 'tsarslib', 'BB_CommonLib',
  'TMC_TrueActions', 'BetterFlashlight',
  'ORGM', 'Brita_Weapons', 'autotsar_trailers',
  'Muldraugh_KY', 'BedfordFalls', 'Eerie_County'
];

const WORKSHOP_ITEMS_LINE = SORTED_ORDER
  .map(id => MOD_DB.find(m => m.modId === id).wsid)
  .join(';');

const MODS_LINE = SORTED_ORDER.join(';');

const MAP_LINE = 'Muldraugh, KY';

const WARNINGS = [
  { tag: 'missing', level: 'red',   msg: 'Brita_Weapons requires Brita_Armor — not in your list.' },
  { tag: 'cycle',   level: 'amber', msg: 'soft cycle: Eerie_County → Muldraugh_KY → (resolved by load_last rule)' },
  { tag: 'conflict',level: 'amber', msg: 'BetterFlashlight and RealisticFlashlight marked incompatible. only the former is enabled.' },
];

window.SORTOF_DATA = {
  SAMPLE_INPUT, SAMPLE_RULES,
  MOD_DB, SORTED_ORDER,
  WORKSHOP_ITEMS_LINE, MODS_LINE, MAP_LINE,
  WARNINGS,
};
