class SecretSeriesDAO {

  public void deleteSecretSeriesById(long id) {
    long now = OffsetDateTime.now().toEpochSecond();
    dslContext.transaction(configuration -> {
      // find the record and lock it until this transaction is complete
      SecretsRecord r = DSL.using(configuration)
          .select()
          .from(SECRETS)
          .where(SECRETS.ID.eq(id).and(SECRETS.CURRENT.isNotNull()))
          .forUpdate()
          .fetchOneInto(SECRETS);
      if (r != null) {
        DSL.using(configuration)
            .update(SECRETS)
            .set(SECRETS.NAME, transformNameForDeletion(r.getName()))
            .set(SECRETS.CURRENT, (Long) null)
            .set(SECRETS.UPDATEDAT, now)
            .where(SECRETS.ID.eq(id))
            .execute();
        DSL.using(configuration)
            .delete(ACCESSGRANTS)
            .where(ACCESSGRANTS.SECRETID.eq(id))
            .execute();
      }
    });
  }

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

}