import moment from 'moment';
import { stringify, checkStringOrDate } from './util.js';

/*
 * Philip Crotwell
 * University of South Carolina, 2019
 * http://www.seis.sc.edu
 */

/** Represent a QuakeML Event. Renamed to Quake as Event conflicts with
  * other uses in javascript.
  */

class Quake {
  constructor() {// what is essential???
  }

  get time() {
    return this._time;
  }

  set time(value) {
    this._time = moment.utc(value);
  }

  get arrivals() {
    return this.preferredOrigin.arrivalList;
  }

  get picks() {
    return this.pickList;
  }

  toString() {
    return stringify(this.time) + ' ' + stringify(this.latitude) + " " + stringify(this.longitude) + ' ' + stringify(this.depth) + ' ' + this.magnitude.toString();
  }

}
/** Represents a QuakeML Origin. */

class Origin {
  constructor() {// what is essential???
  }

  toString() {
    return stringify(this.time) + ' ' + stringify(this.latitude) + " " + stringify(this.longitude) + ' ' + stringify(this.depth);
  }

  get arrivals() {
    return this.arrivalList;
  }

}
/** Represents a QuakeML Magnitude.
 */

class Magnitude {
  constructor(mag, type) {
    this.mag = mag;
    this.type = type;
  }

  toString() {
    return stringify(this.mag) + " " + stringify(this.type);
  }

}
/** Represents a QuakeML Arrival, a combination of a Pick with a phase name.
 */

class Arrival {
  constructor(phase, pick) {
    this.phase = phase;
    this.pick = pick;
  }

}
/** Represents a QuakeML Pick.
 */

class Pick {
  constructor(time, networkCode, stationCode, locationCode, channelCode) {
    this.time = checkStringOrDate(time);
    this.networkCode = networkCode;
    this.stationCode = stationCode;
    this.locationCode = locationCode;
    this.channelCode = channelCode;
  }

}

export { Arrival, Magnitude, Origin, Pick, Quake };
//# sourceMappingURL=quakeml.js.map
