package ru.micord.ervu.account_applications.dao;

import java.util.List;

import org.jooq.DSLContext;
import org.jooq.Table;
import org.springframework.stereotype.Repository;
import ru.micord.ervu.account_applications.db_beans.public_.Tables;
import ru.micord.ervu.account_applications.db_beans.public_.tables.records.UserApplicationRoleRecord;


/**
 * @author Adel Kalimullin
 */
@Repository
public class RoleDao extends AbstractDataDao<UserApplicationRoleRecord> {
  protected RoleDao(DSLContext dsl) {
    super(dsl);
  }

  @Override
  protected Table<UserApplicationRoleRecord> getTable() {
    return Tables.USER_APPLICATION_ROLE;
  }

  public void setActiveStatus(List<String> ids, boolean active) {
    setFieldWhereIn(
        Tables.USER_APPLICATION_ROLE.ACTIVE, active,
        Tables.USER_APPLICATION_ROLE.USER_ROLE_ID, ids
    );
  }
}
