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

export const starboardCommandData = applyCommandDescription(
  new SlashCommandBuilder()
    .setName('starboard')
    .setDefaultMemberPermissions(PermissionFlagsBits.ManageGuild)
    .addSubcommand((s) =>
      applyCommandDescription(s.setName('setup'), 'starboard.setup.description')
        .addChannelOption((o) =>
          applyOptionDescription(
            o
              .setName('channel')
              .addChannelTypes(ChannelType.GuildText, ChannelType.GuildAnnouncement)
              .setRequired(true),
            'starboard.setup.options.channel'
          )
        )
        .addIntegerOption((o) =>
          applyOptionDescription(o.setName('threshold'), 'starboard.setup.options.threshold')
            .setMinValue(1)
            .setMaxValue(100)
            .setRequired(true)
        )
        .addStringOption((o) =>
          applyOptionDescription(o.setName('emoji'), 'starboard.setup.options.emoji')
        )
        .addBooleanOption((o) =>
          applyOptionDescription(
            o.setName('allow_self_star'),
            'starboard.setup.options.allow_self_star'
          )
        )
    )
    .addSubcommand((s) =>
      applyCommandDescription(s.setName('status'), 'starboard.status.description')
    ),
  'starboard.description'
);
