using System.ComponentModel;
using System.Threading.Tasks;
using DSharpPlus.Commands;
using DSharpPlus.Commands.ContextChecks;
using DSharpPlus.Commands.Processors.SlashCommands;
using DSharpPlus.Entities;

namespace SupportChild.Commands;

public class StatusCommand
{
    [RequireGuild]
    [Command("status")]
    [Description("Shows bot status and information.")]
    public async Task OnExecute(SlashCommandContext command)
    {
        long openTickets = Database.GetNumberOfTickets();
        long closedTickets = Database.GetNumberOfClosedTickets();

        DiscordEmbed botInfo = new DiscordEmbedBuilder()
            .WithAuthor("Emotion-stuff/supportchild @ Toastielab", "https://toastielab.dev/Emotions-stuff/SupportChild", "https://cdn.discordapp.com/attachments/765441543100170271/914327948667011132/Ellie_Concept_2_transparent_ver.png")
            .WithTitle("Bot information")
            .WithColor(DiscordColor.Cyan)
            .AddField("Version:", SupportChild.GetVersion(), true)
            .AddField("Open tickets:", openTickets + "", true)
            .AddField("Closed tickets:", closedTickets + " ", true)
            .AddField("Report bugs:", "[Toastielab Issues](https://toastielab.dev/Emotions-stuff/SupportChild/issues)", true)
            .AddField("Commands:", "[Toastielab Repository](https://toastielab.dev/Emotions-stuff/SupportChild)", true);
        await command.RespondAsync(botInfo);
    }
}