import { EmbedBuilder } from "@discordjs/builders";
import getEmojiByName from "./getEmojiByName.js";

const colors = {
    Danger: 0xf27878,
    Warning: 0xf2d478,
    Success: 0x68d49e
};

class EmojiEmbed extends EmbedBuilder {
    _title = "";
    _emoji: string | null = null;
    description = "";

    _generateTitle() {
        if (this._emoji && !this._title) return getEmojiByName(this._emoji)
        if (this._emoji) { return `${getEmojiByName(this._emoji)} ${this._title}`; }
        if (this._title) { return this._title };
        return "";
    }

    override setTitle(title: string) {
        this._title = title;
        const proposedTitle = this._generateTitle();
        if (proposedTitle) super.setTitle(proposedTitle);
        return this;
    }
    override setDescription(description: string) {
        this.description = description;
        super.setDescription(description);
        return this;
    }
    setEmoji(emoji: string) {
        this._emoji = emoji;
        const proposedTitle = this._generateTitle();
        if (proposedTitle) super.setTitle(proposedTitle);
        return this;
    }
    setStatus(color: "Danger" | "Warning" | "Success") {
        this.setColor(colors[color]);
        return this;
    }
}


export default EmojiEmbed;
