import type { BossId } from "./types";

export type BossRoomFloor =
  | "cinder"
  | "desert"
  | "tide"
  | "reliquary"
  | "royal"
  | "prism"
  | "storm"
  | "wilds"
  | "void"
  | "mire"
  | "quarry"
  | "junkyard"
  | "web"
  | "moon"
  | "frost"
  | "warcamp"
  | "sky";

export interface BossRoomDefinition {
  /** Stable room key. Keep this independent from a boss's combat archetype. */
  id: string;
  name: string;
  biome: string;
  floor: BossRoomFloor;
  background: string;
  fog: string;
  sky: string;
  ground: string;
  floorColor: string;
  wallColor: string;
  accent: string;
  accentSecondary: string;
  wallHeight: number;
}

function room(
  id: string,
  name: string,
  biome: string,
  floor: BossRoomFloor,
  colors: Omit<BossRoomDefinition, "id" | "name" | "biome" | "floor">,
): BossRoomDefinition {
  return { id, name, biome, floor, ...colors };
}

/**
 * Every selectable guardian owns a room identity. Rendering composes this small
 * data record into low-cost geometry, so encounter mechanics remain independent
 * from the presentation of the room around them.
 */
export const BOSS_ROOMS = {
  bulldrome: room("cinderstock-coliseum", "Cinderstock Coliseum", "Volcanic fortress", "cinder", {
    background: "#190603", fog: "#351006", sky: "#e36b36", ground: "#120704", floorColor: "#382018", wallColor: "#3d1c15", accent: "#ff7138", accentSecondary: "#ffbd63", wallHeight: 3.8,
  }),
  "sandglass-scorpion": room("sunken-hour", "The Sunken Hour", "Buried sun temple", "desert", {
    background: "#201607", fog: "#51401b", sky: "#e8c56d", ground: "#160f04", floorColor: "#5d4821", wallColor: "#6e5126", accent: "#f6c850", accentSecondary: "#9e672c", wallHeight: 3.2,
  }),
  "cragclaw-crab": room("drowned-breakwater", "The Drowned Breakwater", "Storm-tossed coast", "tide", {
    background: "#041621", fog: "#0b4050", sky: "#7ad9e0", ground: "#031015", floorColor: "#0c3b49", wallColor: "#125264", accent: "#4cd9e7", accentSecondary: "#8ce9c6", wallHeight: 3.4,
  }),
  "mournveil-ghost": room("silent-reliquary", "The Silent Reliquary", "Haunted mausoleum", "reliquary", {
    background: "#11091d", fog: "#332249", sky: "#b89cff", ground: "#0d0714", floorColor: "#2b1c3d", wallColor: "#3e2b52", accent: "#b985ff", accentSecondary: "#e1c1ff", wallHeight: 4.2,
  }),
  "crownshard-golem": room("broken-coronation", "The Broken Coronation", "Shattered royal hall", "royal", {
    background: "#171005", fog: "#463518", sky: "#f0d88b", ground: "#100a03", floorColor: "#493617", wallColor: "#5d441c", accent: "#f1c951", accentSecondary: "#fff0a6", wallHeight: 4.4,
  }),
  "crystal-bat-matriarch": room("prism-echo", "The Prism Echo", "Crystal echo cavern", "prism", {
    background: "#051522", fog: "#174d67", sky: "#92edff", ground: "#041019", floorColor: "#123a52", wallColor: "#1d6078", accent: "#82eaff", accentSecondary: "#d0a5ff", wallHeight: 4.8,
  }),
  "stormwool-alpaca": room("thunder-fleece", "The Thunder Fleece", "Wind-scoured highland", "storm", {
    background: "#071321", fog: "#274d71", sky: "#a4d5ff", ground: "#071019", floorColor: "#233f5d", wallColor: "#365676", accent: "#9bd3ff", accentSecondary: "#eef9ff", wallHeight: 2.8,
  }),
  "cluckhorn-colossus": room("furnace-nest", "The Furnace Nest", "Overgrown brass hatchery", "junkyard", {
    background: "#081615", fog: "#284c45", sky: "#6edccb", ground: "#07100d", floorColor: "#263b32", wallColor: "#5a4123", accent: "#dfaa43", accentSecondary: "#62e3d1", wallHeight: 3.2,
  }),
  "ashwing-demon": room("cinder-choir", "The Cinder Choir", "Ashen cathedral", "cinder", {
    background: "#1b0608", fog: "#511721", sky: "#ee7566", ground: "#120407", floorColor: "#4b1720", wallColor: "#592029", accent: "#ef625c", accentSecondary: "#ffb16e", wallHeight: 5.2,
  }),
  "riftclaw-demon": room("broken-duel", "The Broken Duel", "Fractured void arena", "void", {
    background: "#080315", fog: "#251040", sky: "#c773ff", ground: "#05020e", floorColor: "#1c0f30", wallColor: "#311850", accent: "#d65cff", accentSecondary: "#7458ff", wallHeight: 3.7,
  }),
  "tempestscale-dragon": room("living-storm", "The Living Storm", "Eye of the storm", "sky", {
    background: "#041b2b", fog: "#1d5a73", sky: "#7be4ef", ground: "#041018", floorColor: "#15465d", wallColor: "#24637a", accent: "#57d8ee", accentSecondary: "#d3ffff", wallHeight: 2.1,
  }),
  emberfox: room("burning-trail", "The Burning Trail", "Charred twilight grove", "cinder", {
    background: "#1a0804", fog: "#4a1b0a", sky: "#ff9562", ground: "#0f0603", floorColor: "#412015", wallColor: "#5a2b16", accent: "#ff7d45", accentSecondary: "#ffc56a", wallHeight: 2.9,
  }),
  "mirelord-frog": room("drowned-bell", "The Drowned Bell", "Luminous blackwater mire", "mire", {
    background: "#06170d", fog: "#235c36", sky: "#91dc84", ground: "#030d07", floorColor: "#1c4b2c", wallColor: "#30653b", accent: "#74d66b", accentSecondary: "#bcf08a", wallHeight: 2.5,
  }),
  "stonebreaker-giant": room("walking-crag", "The Walking Crag", "Deep mountain quarry", "quarry", {
    background: "#16100b", fog: "#4a3528", sky: "#d8af82", ground: "#0b0806", floorColor: "#473127", wallColor: "#5b4234", accent: "#d39a62", accentSecondary: "#f0cb9b", wallHeight: 5.5,
  }),
  "glub-sovereign": room("binding-ooze", "The Binding Ooze", "Caustic slime caverns", "mire", {
    background: "#06170f", fog: "#1d5c47", sky: "#76e5bc", ground: "#030c09", floorColor: "#174c3b", wallColor: "#216752", accent: "#66e3b3", accentSecondary: "#d0ffd3", wallHeight: 3.6,
  }),
  "scrapking-goblin": room("jagged-throne", "The Jagged Throne", "Scrap-metal forge", "junkyard", {
    background: "#17100a", fog: "#513b25", sky: "#e1ac62", ground: "#0d0905", floorColor: "#3e3022", wallColor: "#5a462d", accent: "#e0a64c", accentSecondary: "#c9e58d", wallHeight: 3.3,
  }),
  "warcaller-orc": room("red-standard", "The Red Standard", "Siege camp", "warcamp", {
    background: "#1d0807", fog: "#59221c", sky: "#e56b54", ground: "#100505", floorColor: "#48201b", wallColor: "#612a20", accent: "#e8543f", accentSecondary: "#e1b15c", wallHeight: 3.4,
  }),
  "tuskmaw-orc": room("breaker-below", "The Breaker Below", "Bone-strewn badlands", "quarry", {
    background: "#16160b", fog: "#536036", sky: "#b7c67a", ground: "#0a0c05", floorColor: "#3e4525", wallColor: "#596037", accent: "#b6cf6a", accentSecondary: "#e7d08e", wallHeight: 3.5,
  }),
  "broodfang-spider": room("silk-tyrant", "The Silk Tyrant", "Venom web caverns", "web", {
    background: "#140615", fog: "#49234b", sky: "#ce7fff", ground: "#0a030b", floorColor: "#351638", wallColor: "#532052", accent: "#c66cff", accentSecondary: "#88e66f", wallHeight: 4.3,
  }),
  "silkfang-spider": room("gloom-weaver", "The Gloom Weaver", "Moonlit silk grove", "web", {
    background: "#10091b", fog: "#352653", sky: "#b39bff", ground: "#080510", floorColor: "#271b42", wallColor: "#3c2d62", accent: "#a979e7", accentSecondary: "#d1c1ff", wallHeight: 3.8,
  }),
  "thorncrown-stag": room("briar-hart", "The Briar Hart", "Ancient thornwood", "wilds", {
    background: "#071509", fog: "#254e2a", sky: "#9cdb7b", ground: "#040b05", floorColor: "#234326", wallColor: "#355c31", accent: "#7fc96a", accentSecondary: "#d9b965", wallHeight: 4.1,
  }),
  "sky-totem": room("hollow-idol", "The Hollow Idol", "Cloudbound spirit plateau", "sky", {
    background: "#051620", fog: "#1b5960", sky: "#76ded4", ground: "#041014", floorColor: "#154247", wallColor: "#236165", accent: "#66d9cf", accentSecondary: "#e0ffff", wallHeight: 2.3,
  }),
  "razorcrest-raptor": room("hunting-circuit", "The Hunting Circuit", "Overgrown predator ruins", "wilds", {
    background: "#111407", fog: "#4d5522", sky: "#d8d36d", ground: "#080a04", floorColor: "#383d1b", wallColor: "#565a29", accent: "#d8c95c", accentSecondary: "#96d26b", wallHeight: 3.1,
  }),
  "bristlequake-boar": room("iron-tusk", "The Iron Tusk", "Ironwood quarry", "junkyard", {
    background: "#15100a", fog: "#473c2b", sky: "#d89a63", ground: "#090705", floorColor: "#393125", wallColor: "#504636", accent: "#d67d45", accentSecondary: "#d0ba6d", wallHeight: 4.6,
  }),
  "moonfang-wolf": room("silver-pursuit", "The Silver Pursuit", "Moonlit ruins", "moon", {
    background: "#07101d", fog: "#273a61", sky: "#b9d0ff", ground: "#040914", floorColor: "#1f3152", wallColor: "#34476e", accent: "#b3c8ff", accentSecondary: "#ece9ff", wallHeight: 3.9,
  }),
  "frostmaw-yeti": room("white-avalanche", "The White Avalanche", "Glacial ravine", "frost", {
    background: "#061722", fog: "#306779", sky: "#9ceeff", ground: "#031017", floorColor: "#1b5466", wallColor: "#397588", accent: "#8ce5f5", accentSecondary: "#e9ffff", wallHeight: 4.7,
  }),
  "rimeclaw-yeti": room("frozen-duel", "The Frozen Duel", "Frozen mirror palace", "frost", {
    background: "#07162a", fog: "#285a83", sky: "#8fd8ff", ground: "#030c19", floorColor: "#17476d", wallColor: "#2d6691", accent: "#74c8f4", accentSecondary: "#c1f6ff", wallHeight: 4.9,
  }),
  "gravehorn-triceratops": room("fossil-wake", "The Fossil Wake", "Buried ossuary", "reliquary", {
    background: "#100d08", fog: "#40382a", sky: "#d8c79b", ground: "#090704", floorColor: "#332b20", wallColor: "#4c4030", accent: "#d8c79b", accentSecondary: "#8eb9a6", wallHeight: 4.5,
  }),
} as const satisfies Record<BossId, BossRoomDefinition>;

export function bossRoomFor(bossId: BossId): BossRoomDefinition {
  return BOSS_ROOMS[bossId];
}
