import Model, { attr, belongsTo, hasMany } from '@ember-data/model';

export default class WordModel extends Model {
  @attr ('string') verseCode;
  @attr ('string') ulb;
  @attr ('string') greek;
  @attr ('string') lemma;
  @attr ('string') morph;
  @attr ('number') phraseId;
  @attr ('number') sub;
  @attr ('number') ogntSort;
  @attr ('number') ulbSort;
  @attr ('string') strongsNumber;

  @belongsTo('verse') verse;

  @belongsTo('lexical-entry') lexicalEntry;

  @hasMany('morph-legend') morphLegend;

  get isPhrase()
  {
    return this.phraseId !== null;
  }

  get isPhraseRoot()
  {
    console.log("Called isPhraseRoot on " + this.verseCode)
    return this.strongsNumber == '-1';
  }
}
