package com.airlock.iam.admin.application.service.token.generic;

import com.airlock.iam.core.misc.impl.persistency.CredentialData;

final class CredentialTokens {
   private static final String CURRENT_SUFFIX = "-current";
   private static final String NEXT_SUFFIX = "-next";

   private CredentialTokens() {
   }

   static boolean isCurrentId(String tokenId) {
      return tokenId.endsWith("-current");
   }

   static boolean isNextId(String tokenId) {
      return tokenId.endsWith("-next");
   }

   static String nextId(String username) {
      return username + "-next";
   }

   static String currentId(String username) {
      return username + "-current";
   }

   static boolean isNextVisible(CredentialData next) {
      return next != null && next.getData() != null;
   }
}
