/*
 * Copyright ©Δ∞ 仙上主天
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, are permitted provided
 * that the following conditions are met:
 * 
 * * Redistributions of source code must retain the above copyright notice, this list of conditions and the
 *   following disclaimer.
 * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
 *   the following disclaimer in the documentation and/or other materials provided with the distribution.
 * * The prime PI creator license super seeds all other licenses, this license is overly invasive,
 *   thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
 *   Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
 *   even on air gaped systems, all information in the universe is owned by the pi creator.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package love.distributedrebirth.numberxd;

import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
import java.util.stream.Collectors;

import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAuthor注;

@DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
public enum Gê̄ldGetậlÅtHebrewLetter {
	// Unicode is horror in any language else than ascii;
	// VS Alphabet order
	// VS Unicode order
	// VS Gematria order <== leading but with other decimals
	
	NONE      (0,  (char) 0x05EF),
	
	LETTER_1  (1,  (char) 0x05D0),
	LETTER_2  (2,  (char) 0x05D1),
	LETTER_3  (3,  (char) 0x05D2),
	LETTER_4  (4,  (char) 0x05D3),
	LETTER_5  (5,  (char) 0x05D4),
	LETTER_6  (6,  (char) 0x05D5),
	LETTER_7  (7,  (char) 0x05D6),
	LETTER_8  (8,  (char) 0x05D7),
	LETTER_9  (9,  (char) 0x05D8),

	LETTER_11 (11, (char) 0x05D9),
	LETTER_12 (12, (char) 0x05DB),
	LETTER_13 (13, (char) 0x05DC),
	LETTER_14 (14, (char) 0x05DE),
	LETTER_15 (15, (char) 0x05E0),
	LETTER_16 (16, (char) 0x05E1),
	LETTER_17 (17, (char) 0x05E2),
	LETTER_18 (18, (char) 0x05E4),
	LETTER_19 (19, (char) 0x05E6),
	
	LETTER_21 (21, (char) 0x05E7),
	LETTER_22 (22, (char) 0x05E8),
	LETTER_23 (23, (char) 0x05E9),
	LETTER_24 (24, (char) 0x05EA),
	LETTER_25 (25, (char) 0x05DA),
	LETTER_26 (26, (char) 0x05DD),
	LETTER_27 (27, (char) 0x05DF),
	LETTER_28 (28, (char) 0x05E3),
	LETTER_29 (29, (char) 0x05E5),
	
/*	// OLD
	LETTER_11 (10, (char) 0x05D9),
	LETTER_12 (20, (char) 0x05DB),
	LETTER_13 (30, (char) 0x05DC),
	LETTER_14 (40, (char) 0x05DE),
	LETTER_15 (50, (char) 0x05E0),
	LETTER_16 (60, (char) 0x05E1),
	LETTER_17 (70, (char) 0x05E2),
	LETTER_18 (80, (char) 0x05E4),
	LETTER_19 (90, (char) 0x05E6),
	
	LETTER_21 (100, (char) 0x05E7),
	LETTER_22 (200, (char) 0x05E8),
	LETTER_23 (300, (char) 0x05E9),
	LETTER_24 (400, (char) 0x05EA),
	LETTER_25 (500, (char) 0x05DA),
	LETTER_26 (600, (char) 0x05DD),
	LETTER_27 (700, (char) 0x05DF),
	LETTER_28 (800, (char) 0x05E3),
	LETTER_29 (900, (char) 0x05E5),
	*/
	LETTER_31 (31, (char) 0x05BE),
	LETTER_32 (32, (char) 0x05C0),
	LETTER_33 (33, (char) 0x05C3),
	LETTER_34 (34, (char) 0x05C6),
	;
	
	public static final byte BITMASK = 0b00011111;
	public static final byte SHIFT_5 = 5;
	private final int decimal;
	private final char character;
	
	private static final Map<Character, Gê̄ldGetậlÅtHebrewLetter> CHAR_MAP = Collections.unmodifiableMap(
			Arrays.asList(values()).stream().collect(Collectors.toMap(v -> v.getCharacter(), v -> v)));
	
	private Gê̄ldGetậlÅtHebrewLetter(int decimal, char character) {
		this.decimal = decimal;
		this.character = character;
	}
	
	public int getDecimal() {
		return decimal;
	}
	
	public char getCharacter() {
		return character;
	}
	
	public static Gê̄ldGetậlÅtHebrewLetter indexOf(int index) {
		return values()[index & BITMASK];
	}
	
	public static Gê̄ldGetậlÅtHebrewLetter valueOfCharacter(char codePoint) {
		return CHAR_MAP.getOrDefault(codePoint, Gê̄ldGetậlÅtHebrewLetter.NONE);
	}
}