text: 'use strict'
  
  /** @type {typeof import('@adonisjs/lucid/src/Lucid/Model')} */
  const Model = use('Model')
  
  /** @type {import('@adonisjs/framework/src/Hash')} */
  const Hash = use('Hash')
  
  class User extends Model {
    static boot () {
      super.boot()
  
      /**
       * A hook to hash the user password before saving
       * it to the database.
       */
      this.addHook('beforeSave', async (userInstance) => {
        if (userInstance.dirty.password) {
          userInstance.password = await Hash.make(userInstance.password)
        }
      })
    }
  
  
    tokens () {
      return this.hasMany('App/Models/Token')
    }
    usercrosswords () {
      return this.hasMany('App/Models/UserCrosswords')
    }
    useranswers () {
      return this.hasMany('App/Models/UserAnswers')
    }
  
     crosswords() {
        return this.belongsToMany('App/Models/Crossword').pivotTable('user_crosswords')
      }
  }
  
  module.exports = User
  