/*
 *   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.velocitycore.discord;

import lombok.AllArgsConstructor;
import net.dv8tion.jda.api.entities.emoji.Emoji;
import net.dv8tion.jda.api.interactions.components.buttons.Button;
import net.dv8tion.jda.api.interactions.components.buttons.ButtonStyle;

@AllArgsConstructor
public enum DiscordTicketType {
    REPORT("U+1F46E", "Spieler melden", ButtonStyle.DANGER, null),
    IDEA("U+1F4A1", "Feature vorschlagen", ButtonStyle.SUCCESS, null),
    BUG("U+1F41B", "Bug melden", ButtonStyle.LINK, "https://git.steamwar.de/SteamWar/SteamWar/issues/new/choose"),
    QUESTION("U+2753", "Fragen", ButtonStyle.PRIMARY, null),
    APPEAL("U+1F528", "Entbannungsantrag", ButtonStyle.SECONDARY, null),
    SCHEMATIC("U+1F4BE", "Schematic melden", ButtonStyle.DANGER, null);


    private final String emoji;
    private final String label;
    private final ButtonStyle style;
    private final String url;

    public Button toButton() {
        if (style == ButtonStyle.LINK) {
            return Button.link(url, label).withEmoji(Emoji.fromUnicode(emoji));
        }
        return Button.of(style, name().toLowerCase(), Emoji.fromUnicode(emoji)).withLabel(label);
    }

    public String introduction() {
        return "DC_TICKETINTRO_" + name();
    }
}
