import Service from '@ember/service';
import { tracked } from "@glimmer/tracking";
import { inject as service } from '@ember/service';

export default class WordSelectService extends Service {
  @service store;

  @tracked currentWord = '';
  @tracked strongsNumber = '';
  @tracked lexicalEntry;

  select(word) {
    this.currentWord = word;
    this.strongsNumber = word.strongsNumber;
    // this.getLexicalEntry();
  }

  async getLexicalEntry() {
    this.lexicalEntry = await this.store.findRecord('lexical-entry', this.strongsNumber);
  }

  current() {
    return this.currentWord;
  }

  isCurrentByOgntId(word) {
    return word.ogntSort === this.currentWord.ogntSort;
  }

  isCurrentByStrongsNumber(word) {
    return word.strongs_number === this.currentWord.strongsNumber
  }
}
