package net.viper.status.modules.chat;

/**
 * Repr\u00e4sentiert einen Chat-Kanal mit allen zugeh\u00f6rigen Einstellungen.
 */
public class ChatChannel {

    private final String id;
    private final String name;
    private final String symbol;
    private final String permission;
    private final String color;
    private final String format;
    private final boolean localOnly;

    // Bridge-Einstellungen
    private final String discordWebhook;
    private final String discordChannelId;
    private final String telegramChatId;
    private final int    telegramThreadId;  // 0 = kein Thema, >0 = Themen-ID
    private final boolean useAdminBridge;

    public ChatChannel(String id, String name, String symbol, String permission,
                       String color, String format, boolean localOnly,
                       String discordWebhook, String discordChannelId,
                       String telegramChatId, int telegramThreadId, boolean useAdminBridge) {
        this.id = id;
        this.name = name;
        this.symbol = symbol;
        this.permission = permission;
        this.color = color;
        this.format = format;
        this.localOnly = localOnly;
        this.discordWebhook = discordWebhook;
        this.discordChannelId = discordChannelId;
        this.telegramChatId = telegramChatId;
        this.telegramThreadId = telegramThreadId;
        this.useAdminBridge = useAdminBridge;
    }

    public String getId() { return id; }
    public String getName() { return name; }
    public String getSymbol() { return symbol; }
    public String getPermission() { return permission; }
    public String getColor() { return color; }
    public String getFormat() { return format; }
    public boolean isLocalOnly() { return localOnly; }
    public String getDiscordWebhook() { return discordWebhook; }
    public String getDiscordChannelId() { return discordChannelId; }
    public String getTelegramChatId() { return telegramChatId; }
    public int getTelegramThreadId()  { return telegramThreadId; }
    public boolean isUseAdminBridge() { return useAdminBridge; }

    /** Pr\u00fcft ob der Kanal eine Permission erfordert. */
    public boolean hasPermission() {
        return permission != null && !permission.isEmpty();
    }

    /** Gibt das formatierte Kanalprefix zur\u00fcck, z.B. §a[G] */
    public String getFormattedTag() {
        return net.md_5.bungee.api.ChatColor.translateAlternateColorCodes('&',
                color + "[" + symbol + "]");
    }

    @Override
    public String toString() {
        return "ChatChannel{id=" + id + ", name=" + name + "}";
    }
}