const GenericDBApi = require('./base.api');
const db = require('../models');

class PermissionsDBApi extends GenericDBApi {
  static get MODEL() {
    return db.permissions;
  }

  static get TABLE_NAME() {
    return 'permissions';
  }

  static get SEARCHABLE_FIELDS() {
    return ['name'];
  }

  static get RANGE_FIELDS() {
    return [];
  }

  static get ENUM_FIELDS() {
    return [];
  }

  static get CSV_FIELDS() {
    return ['id', 'name', 'createdAt'];
  }

  static get AUTOCOMPLETE_FIELD() {
    return 'name';
  }

  static get ASSOCIATIONS() {
    return [];
  }

  static get FIND_BY_INCLUDES() {
    return [];
  }

  static get FIND_ALL_INCLUDES() {
    return [];
  }

  static getFieldMapping(data) {
    return {
      id: data.id || undefined,
      name: data.name || null,
    };
  }
}

module.exports = PermissionsDBApi;
