package com.airlock.iam.plugin.configeditor.ui.notifications;

import java.util.Optional;

public final class NotificationMessage {
   public static final String LOADED_ACTIVE_CONFIG_FILE = "Successfully loaded configuration.";
   public static final String LOADED_DRAFT_CONFIG_FILE = "Successfully loaded draft configuration.";
   public static final String NO_CONFIG_LOADED = "No configuration loaded.";
   public static final String ERROR = "Error: ";
   public static final String VALUE_NO_MATCH = "The values do not match.";
   public static final String REENTER_VALUE = "Please enter the same value twice.";
   public static final String EXTERNAL_CONFIG_FILE_MODIFICATION_CAPTION = "Active configuration changed.";
   public static final String EXTERNAL_CONFIG_FILE_MODIFICATION = "Another user has changed the active configuration. Activation of your configuration will overwrite all changes from other users. Save your configuration and reload the active configuration.";

   public static String createContextMessage(String contextIdentifier) {
      return "Context \"" + contextIdentifier + "\" created.";
   }

   public static String deleteContextMessage(String contextIdentifier) {
      return "Context \"" + contextIdentifier + "\" deleted.";
   }

   public static String externalConfigFileModificationMessage(Optional<String> historyItemText) {
      String historyInfo = historyItemText.<String>map(it -> "\n\n Most recent config activation: \"" + it + "\"").orElse("");
      return "Another user has changed the active configuration. Activation of your configuration will overwrite all changes from other users. Save your configuration and reload the active configuration."
         + historyInfo;
   }

   private NotificationMessage() {
      throw new AssertionError();
   }
}
