package gui.constants;

import java.util.ArrayList;
import java.util.List;

public enum Symbols {

	Numbers("Nombres", getNumbers()),
	Letters("Lettres", getLetters()),
	Russian("Cyrilique", getRussian()),
	Emojis("Emojis (Console uniquement)", getEmojis());

	String displayName;
	List<String> symbols;

	private Symbols(String displayName, List<String> symbols) {
		this.symbols = symbols;
		this.displayName = displayName;
	}

	public String getDisplayName() {
		return displayName;
	}

	public List<String> getSymbols() {
		return symbols;
	}

	private static List<String> getNumbers() {
		List<String> sym = new ArrayList<>();
		for (int i = 1; i <= 100; i++) {
			sym.add(Integer.toString(i));
		}
		return sym;
	}

	private static List<String> getLetters() {
		List<String> sym = new ArrayList<>();
		for (int i = 0; i < 100; i++) {
			int currentOffset = i;
			String letter = "";
			while (currentOffset >= 26) {
				letter += Character.toString((char) ('A' + currentOffset % 26));
				currentOffset /= 26;
				currentOffset--;
			}
			letter += Character.toString((char) ('A' + currentOffset % 26));
			sym.add(new StringBuilder(letter).reverse().toString());
		}
		return sym;
	}

	private static List<String> getRussian() {
		List<String> sym = new ArrayList<>();
		for (int i = 0; i < 100; i++) {
			sym.add(new String(Character.toChars(0X0400 + i)));
		}
		return sym;
	}

	private static List<String> getEmojis() {
		List<String> sym = new ArrayList<>();
		for (int i = 0; i < 100; i++) {
			sym.add(new String(Character.toChars(0X1F600 + i)));
		}
		return sym;
	}

	private static final String[] symbolNames;

	static {
		Symbols[] symbols = Symbols.values();
		symbolNames = new String[symbols.length];
		for (int i = 0; i < symbols.length; i++) {
			symbolNames[i] = symbols[i].getDisplayName();
		}
	}

	public static String[] getSymbolsNames() {
		return symbolNames;
	}

}
