class SecretSeriesDAO {

  public int setCurrentVersion(long secretId, long secretContentId, String updater, long now) {
    long checkId;
    Record1<Long> r = dslContext.select(SECRETS_CONTENT.SECRETID)
        .from(SECRETS_CONTENT)
        .where(SECRETS_CONTENT.ID.eq(secretContentId))
        .fetchOne();
    if (r == null) {
      throw new BadRequestException(
          String.format("The requested version %d is not a known version of this secret",
              secretContentId));
    }

    checkId = r.value1();
    if (checkId != secretId) {
      throw new IllegalStateException(String.format(
          "tried to reset secret with id %d to version %d, but this version is not associated with this secret",
          secretId, secretContentId));
    }

    return dslContext.update(SECRETS)
        .set(SECRETS.CURRENT, secretContentId)
        .set(SECRETS.UPDATEDBY, updater)
        .set(SECRETS.UPDATEDAT, now)
        .where(SECRETS.ID.eq(secretId))
        .execute();
  }

  private  SecretSeriesDAO(DSLContext dslContext, ObjectMapper mapper,
      SecretSeriesMapper secretSeriesMapper, RowHmacGenerator rowHmacGenerator);

}