use poise::{serenity_prelude::CreateEmbed, CreateReply};
use serde::{Deserialize, Serialize};

use crate::{
    consts::THEME_COLOR,
    utils::{footer, Extract, Recordable},
    Context, Error,
};

#[derive(Serialize, Deserialize, Extract)]
pub struct Options;

impl Recordable for Options {
    async fn run(self, ctx: Context<'_>) -> Result<(), Error> {
        let footer = footer(ctx);

        ctx.send(
            CreateReply::default().ephemeral(true).embed(
                CreateEmbed::new()
                    .title("Help")
                    .color(*THEME_COLOR)
                    .description(
                        "__Info Commands__
`/help` `/info` `/patreon` `/dashboard` `/clock`
*run these commands with no options*

__Reminder Commands__
`/remind` - Create a new reminder that will send a message at a certain time
`/timer` - Start a timer from now, that will count time passed. Also used to view and remove timers

__Reminder Management__
`/delete` - Delete reminders
`/look` - View reminders
`/pause` - Pause all reminders on the channel
`/offset` - Move all reminders by a certain time
`/nudge` - Move all new reminders on this channel by a certain time

__Todo Commands__
`/todo` - Add, view and manage the server, channel or user todo lists

__Setup Commands__
`/timezone` - Set your timezone (necessary for `/remind` to work properly)
`/dm allow/block` - Change your DM settings for reminders.
`/settings ephemeral` - Set reminder confirmations to disappear.

__Advanced Commands__
`/macro` - Record and replay command sequences
                    ",
                    )
                    .footer(footer),
            ),
        )
        .await?;

        Ok(())
    }
}

/// Get an overview of bot commands
#[poise::command(slash_command, rename = "help", identifying_name = "help")]
pub async fn command(ctx: Context<'_>) -> Result<(), Error> {
    (Options {}).run(ctx).await
}
