class ClientDAO {

  public long createClient(String name, String user, String description,
      @Nullable URI spiffeId) {
    ClientsRecord r = dslContext.newRecord(CLIENTS);

    long now = OffsetDateTime.now().toEpochSecond();

    long generatedId = rowHmacGenerator.getNextLongSecure();
    String rowHmac = rowHmacGenerator.computeRowHmac(
        CLIENTS.getName(), List.of(name, generatedId));

    // Do not allow empty spiffe URIs
    String spiffeStr = null;
    if (spiffeId != null && !spiffeId.toASCIIString().isEmpty()) {
      spiffeStr = spiffeId.toASCIIString();
    }

    r.setId(generatedId);
    r.setName(name);
    r.setCreatedby(user);
    r.setCreatedat(now);
    r.setUpdatedby(user);
    r.setUpdatedat(now);
    r.setLastseen(null);
    r.setDescription(description);
    r.setEnabled(true);
    r.setAutomationallowed(false);
    r.setSpiffeId(spiffeStr);
    r.setRowHmac(rowHmac);
    r.store();

    return r.getId();
  }

  private  ClientDAO(DSLContext dslContext, ClientMapper clientMapper,
      RowHmacGenerator rowHmacGenerator);

}