import { Deserialize } from "../util/deserialize.model";

export class DiscoveryZoneModel implements Deserialize {
  id: number;
  name: string;

  sizeX: number = 0;
  sizeY: number = 0;
  sizeZ: number = 0;

  worldX: number = 0;
  worldY: number = 0;
  rotation: number = 0;

  xp: number = 0;

  allowSea: boolean = false;
  explorerNoteIndex: number = 0;

  bIsManuallyPlaced: boolean = false;
  ManualVolumeName: string;

  deserialize(input: any): this {
    Object.assign(this, input);
    return this;
  }

  toJSON(): object {
    let json = Object.assign({}, this);
    // Key not shown at all if manually placed.
    if (!json.bIsManuallyPlaced) delete json.ManualVolumeName;
    return json;
  }
}