import { Resource } from "./basic"
import { Project } from "./structure"

export interface Wonder {
  name: string
  innateResource: Resource
  stages: Project[]
}

const wonderList: Wonder[] = [
  {
    name: 'Great Pyramid of Giza A',
    innateResource: 'stone',
    stages: [
      { cost: new Map([['stone', 2]]), points: 3 },
      { cost: new Map([['wood', 3]]), points: 5 },
      { cost: new Map([['stone', 4]]), points: 7 },
    ],
  }, {
    name: 'Great Pyramid of Giza B',
    innateResource: 'stone',
    stages: [
      { cost: new Map([['wood', 2]]), points: 3 },
      { cost: new Map([['stone', 3]]), points: 5 },
      { cost: new Map([['brick', 3]]), points: 5 },
      { cost: new Map([['paper', 1], ['stone', 4]]), points: 7 },
    ],
  }, {
    name: 'Hanging Gardens of Babylon A',
    innateResource: 'brick',
    stages: [
      { cost: new Map([['brick', 2]]), points: 3 },
      { cost: new Map([['wood', 3]]), sciences: new Set(['engineering', 'research', 'education']) },
      { cost: new Map([['brick', 4]]), points: 7 },
    ],
  }, {
    name: 'Hanging Gardens of Babylon B',
    innateResource: 'brick',
    stages: [
      { cost: new Map([['cloth', 1], ['brick', 1]]), points: 3 },
      { cost: new Map([['glass', 1], ['wood', 2]]), playBothOnLastTurn: true },
      { cost: new Map([['paper', 1], ['brick', 3]]), sciences: new Set(['engineering', 'research', 'education']) },
    ],
  }, {
    name: 'Temple of Artemis at Ephesus A',
    innateResource: 'paper',
    stages: [
      { cost: new Map([['stone', 2]]), points: 3 },
      { cost: new Map([['wood', 2]]), gold: 9 },
      { cost: new Map([['paper', 2]]), points: 7 },
    ],
  }, {
    name: 'Temple of Artemis at Ephesus B',
    innateResource: 'paper',
    stages: [
      { cost: new Map([['stone', 2]]), points: 2, gold: 4 },
      { cost: new Map([['wood', 2]]), points: 3, gold: 4 },
      { cost: new Map([['paper', 1], ['cloth', 1], ['glass', 1]]), points: 5, gold: 4 },
    ],
  }, {
    name: 'Statue of Zeus at Olympia A',
    innateResource: 'wood',
    stages: [
      { cost: new Map([['wood', 2]]), points: 3 },
      { cost: new Map([['stone', 2]]), ignoreCostOncePerAge: true },
      { cost: new Map([['ore', 2]]), points: 7 },
    ],
  }, {
    name: 'Statue of Zeus at Olympia B',
    innateResource: 'wood',
    stages: [
      { cost: new Map([['wood', 2]]), discountTrade: [{ resourceType: 'basic', direction: ['left', 'right'], amount: 1 }] },
      { cost: new Map([['stone', 2]]), points: 5 },
      { cost: new Map([['cloth', 1], ['ore', 2]]), copyNeighboringGuild: true },
    ],
  }, {
    name: 'Mausoleum at Halicarnassus A',
    innateResource: 'cloth',
    stages: [
      { cost: new Map([['brick', 2]]), points: 3 },
      { cost: new Map([['ore', 3]]), buildDiscardedNow: true },
      { cost: new Map([['cloth', 2]]), points: 7 },
    ],
  }, {
    name: 'Mausoleum at Halicarnassus B',
    innateResource: 'cloth',
    stages: [
      { cost: new Map([['ore', 2]]), points: 2, buildDiscardedNow: true },
      { cost: new Map([['brick', 3]]), points: 1, buildDiscardedNow: true },
      { cost: new Map([['paper', 1], ['cloth', 1], ['glass', 1]]), buildDiscardedNow: true },
    ],
  }, {
    name: 'Colossus of Rhodes A',
    innateResource: 'ore',
    stages: [
      { cost: new Map([['wood', 2]]), points: 3 },
      { cost: new Map([['brick', 3]]), shields: 2 },
      { cost: new Map([['ore', 4]]), points: 7 },
    ],
  }, {
    name: 'Colossus of Rhodes B',
    innateResource: 'ore',
    stages: [
      { cost: new Map([['stone', 3]]), shields: 1, points: 3, gold: 3 },
      { cost: new Map([['ore', 4]]), shields: 1, points: 4, gold: 4 },
    ],
  }, {
    name: 'Lighthouse of Alexandria A',
    innateResource: 'glass',
    stages: [
      { cost: new Map([['stone', 2]]), points: 3 },
      { cost: new Map([['ore', 2]]), resources: new Map([['brick', 1], ['ore', 1], ['wood', 1], ['stone', 1]]) },
      { cost: new Map([['glass', 2]]), points: 7 },
    ],
  }, {
    name: 'Lighthouse of Alexandria B',
    innateResource: 'glass',
    stages: [
      { cost: new Map([['brick', 2]]), resources: new Map([['brick', 1], ['ore', 1], ['wood', 1], ['stone', 1]]) },
      { cost: new Map([['wood', 2]]), resources: new Map([['glass', 1], ['cloth', 1], ['paper', 1]]) },
      { cost: new Map([['stone', 3]]), points: 7 },
    ],
  },
]
export const wonders = new Map(wonderList.map(w => [w.name, w]))
