const logs = [
    "channelUpdate",
    "emojiUpdate",
    "stickerUpdate",
    "guildUpdate",
    "guildMemberUpdate",
    "guildMemberPunish",
    "guildRoleUpdate",
    "guildInviteUpdate",
    "messageUpdate",
    "messageDelete",
    "messageDeleteBulk",
    "messageReactionUpdate",
    "messageMassPing",
    "messageAnnounce",
    "threadUpdate",
    "webhookUpdate",
    "guildMemberVerify",
    "autoModeratorDeleted",
    "nucleusSettingsUpdated",
    "ticketUpdate"
];

const tickets = [
    "support",
    "report",
    "question",
    "issue",
    "suggestion",
    "other"
];

const toHexInteger = (permissions, array?) => {
    if (!array) {
        array = logs;
    }
    let int = 0n;

    for(const perm of permissions) {
        int += BigInt(2 ** array.indexOf(perm));
    }
    return int.toString(16);
};

const toHexArray = (permissionsHex, array?) => {
    if (!array) {
        array = logs;
    }
    const permissions = [];
    const int = (BigInt("0x" + permissionsHex)).toString(2).split("").reverse();
    for (const index in int) {
        if (int[index] === "1" && array.length > index) {
            permissions.push(array[index]);
        }
    }
    return permissions;
};

export {
    toHexInteger,
    toHexArray,
    tickets,
    logs
};