/*
 *   This file is a part of the SteamWar software.
 *
 *   Copyright (C) 2025 SteamWar.de-Serverteam
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU Affero General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *   GNU Affero General Public License for more details.
 *
 *   You should have received a copy of the GNU Affero General Public License
 *   along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

package de.steamwar.fightsystem.utils;

import org.bukkit.ChatColor;
import org.bukkit.DyeColor;

import java.util.EnumMap;
import java.util.Map;

public class ColorConverter {
    private ColorConverter(){}

    private static final Map<ChatColor, DyeColor> chat2dye = new EnumMap<>(ChatColor.class);

    static{
        chat2dye.put(ChatColor.WHITE, DyeColor.WHITE);
        chat2dye.put(ChatColor.GOLD, DyeColor.ORANGE);
        chat2dye.put(ChatColor.LIGHT_PURPLE, DyeColor.MAGENTA);
        chat2dye.put(ChatColor.BLUE, DyeColor.LIGHT_BLUE);
        chat2dye.put(ChatColor.YELLOW, DyeColor.YELLOW);
        chat2dye.put(ChatColor.GREEN, DyeColor.LIME);
        chat2dye.put(ChatColor.RED, DyeColor.RED);
        chat2dye.put(ChatColor.DARK_GRAY, DyeColor.GRAY);
        chat2dye.put(ChatColor.DARK_AQUA, DyeColor.CYAN);
        chat2dye.put(ChatColor.DARK_PURPLE, DyeColor.PURPLE);
        chat2dye.put(ChatColor.DARK_BLUE, DyeColor.BLUE);
        chat2dye.put(ChatColor.AQUA, DyeColor.CYAN);
        chat2dye.put(ChatColor.DARK_GREEN, DyeColor.GREEN);
        chat2dye.put(ChatColor.DARK_RED, DyeColor.RED);
        chat2dye.put(ChatColor.BLACK, DyeColor.BLACK);
        chat2dye.put(ChatColor.GRAY, FlatteningWrapper.impl.getSilver());
    }

    public static DyeColor chat2dye(ChatColor color){
        return chat2dye.get(color);
    }
}
