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

export class ServerModel implements Deserialize {
  // General Settings
  name: string;
  gridX: number;
  gridY: number;
  isHomeServer: boolean;

  // Connection Settings
  ip: string;
  port: number;
  gamePort: number;
  seamlessDataPort: number;

  OverrideShooterGameModeDefaultGameIni: object;
  floorZDist: number;
  utcOffset: number;
  transitionMinZ: number;
  GlobalBiomeSeamlessServerGridPreOffsetValues: string;
  GlobalBiomeSeamlessServerGridPreOffsetValuesOceanWater: string;
  OceanDinoDepthEntriesOverride: string;
  oceanFloatsamCratesOverride: string;
  treasureMapLootTablesOverride: string;
  oceanEpicSpawnEntriesOverrideTemplateName: string;
  NPCShipSpawnEntriesOverrideTemplateName: string;
  regionOverrides: string;
  waterColorR: number;
  waterColorG: number;
  waterColorB: number;
  skyStyleIndex: number;
  serverIslandPointsMultiplier: number;
  lastModified: string;
  lastImageOverride: string;

  extraSublevels: string[];
  totalExtraSublevels: string[];
  islandInstances;
  discoZones;
  spawnRegions;
  serverTemplateName: string;

  sublevels: ServerSublevelModel[];

  // Irrelevant, used internally by Grapeshot
  //MachineIdTag: string;
  // Probably also irrelevant
  //AdditionalCmdLineParams: string;

  // Used by ServerGridEditor
  //islandLocked: boolean;
  //discoLocked: boolean;
  //pathsLocked: boolean;


  deserialize(input: any): this {
    Object.assign(this, input);
    this.sublevels = this.sublevels.map(i => new ServerSublevelModel().deserialize(i));
    return this;
  }
}