import { ChannelType } from 'discord.js';
import { applyCommandDescription, applyOptionDescription } from '@nexumi/shared';
import { SlashCommandBuilder } from 'discord.js';

export const suggestCommandData = applyCommandDescription(
  new SlashCommandBuilder()
    .setName('suggest')
    .addStringOption((o) =>
      applyOptionDescription(o.setName('content').setRequired(true), 'suggest.options.content')
    ),
  'suggest.description'
);

export const suggestionCommandData = applyCommandDescription(
  new SlashCommandBuilder()
    .setName('suggestion')
    .addSubcommand((s) =>
      applyCommandDescription(s.setName('setup'), 'suggestion.setup.description')
        .addChannelOption((o) =>
          applyOptionDescription(
            o.setName('open_channel').addChannelTypes(ChannelType.GuildText).setRequired(true),
            'suggestion.setup.options.open_channel'
          )
        )
        .addChannelOption((o) =>
          applyOptionDescription(
            o.setName('approved_channel').addChannelTypes(ChannelType.GuildText),
            'suggestion.setup.options.approved_channel'
          )
        )
        .addChannelOption((o) =>
          applyOptionDescription(
            o.setName('denied_channel').addChannelTypes(ChannelType.GuildText),
            'suggestion.setup.options.denied_channel'
          )
        )
        .addBooleanOption((o) =>
          applyOptionDescription(o.setName('create_thread'), 'suggestion.setup.options.create_thread')
        )
    )
    .addSubcommand((s) =>
      applyCommandDescription(s.setName('approve'), 'suggestion.approve.description')
        .addStringOption((o) =>
          applyOptionDescription(
            o.setName('suggestion_id').setRequired(true),
            'suggestion.options.suggestion_id'
          )
        )
        .addStringOption((o) =>
          applyOptionDescription(o.setName('reason').setRequired(true), 'suggestion.options.reason')
        )
    )
    .addSubcommand((s) =>
      applyCommandDescription(s.setName('deny'), 'suggestion.deny.description')
        .addStringOption((o) =>
          applyOptionDescription(
            o.setName('suggestion_id').setRequired(true),
            'suggestion.options.suggestion_id'
          )
        )
        .addStringOption((o) =>
          applyOptionDescription(o.setName('reason').setRequired(true), 'suggestion.options.reason')
        )
    )
    .addSubcommand((s) =>
      applyCommandDescription(s.setName('consider'), 'suggestion.consider.description')
        .addStringOption((o) =>
          applyOptionDescription(
            o.setName('suggestion_id').setRequired(true),
            'suggestion.options.suggestion_id'
          )
        )
        .addStringOption((o) =>
          applyOptionDescription(o.setName('reason').setRequired(true), 'suggestion.options.reason')
        )
    )
    .addSubcommand((s) =>
      applyCommandDescription(s.setName('implement'), 'suggestion.implement.description')
        .addStringOption((o) =>
          applyOptionDescription(
            o.setName('suggestion_id').setRequired(true),
            'suggestion.options.suggestion_id'
          )
        )
        .addStringOption((o) =>
          applyOptionDescription(o.setName('reason').setRequired(true), 'suggestion.options.reason')
        )
    ),
  'suggestion.description'
);
