/* eslint-env node */

const schema = require("@colyseus/schema"),
  Schema = schema.Schema;

class GazePoint extends Schema {

  constructor(screenX, screenY, createdAt, color) {
    super();
    this.screenX = screenX;
    this.screenY = screenY;
    this.createdAt = createdAt;
    this.color = color;
    this.relativeAge = 0;
  }

  static fromClientData(data) {
    return new GazePoint(data.screenX, data.screenY, data.createdAt, data.color);
  }

}

schema.defineTypes(GazePoint, {
  screenX: "number",
  screenY: "number",
  createdAt: "number",
  relativeAge: "number",
  color: "string",
});

module.exports = GazePoint;