import { IslandDataModel } from "./island-data.model";
// Original from Grapeshot
import * as rawIslandData from '../islands.json';
// Split down files with updates
import * as rawMntAData from '../mnt/a/islands.json';

interface IslandDataMap {
  [name: string]: IslandDataModel
}

export class Islands {
  islandData: IslandDataMap = {};

  constructor() {
    // Split down so easier to maintain each type
    [
      rawIslandData,
      rawMntAData
    ].forEach(r => {
      const data = (r as any).default;
      Object.keys(data).forEach(i => {
        this.islandData[i] = new IslandDataModel().deserialize(data[i]);
      })
    });
  }
}