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

export const rankCommandData = applyCommandDescription(
  new SlashCommandBuilder().setName('rank'),
  'leveling.rank.description'
).addUserOption((option) =>
  applyOptionDescription(option.setName('user'), 'leveling.rank.options.user')
);

export const leaderboardCommandData = applyCommandDescription(
  new SlashCommandBuilder().setName('leaderboard'),
  'leveling.leaderboard.description'
);

export const xpCommandData = applyCommandDescription(
  new SlashCommandBuilder().setName('xp'),
  'leveling.xp.description'
)
  .addSubcommand((sub) =>
    applyCommandDescription(sub.setName('give'), 'leveling.xp.give.description')
      .addUserOption((option) =>
        applyOptionDescription(option.setName('user').setRequired(true), 'leveling.xp.options.user')
      )
      .addIntegerOption((option) =>
        applyOptionDescription(
          option.setName('amount').setRequired(true).setMinValue(1).setMaxValue(1_000_000),
          'leveling.xp.options.amount'
        )
      )
  )
  .addSubcommand((sub) =>
    applyCommandDescription(sub.setName('remove'), 'leveling.xp.remove.description')
      .addUserOption((option) =>
        applyOptionDescription(option.setName('user').setRequired(true), 'leveling.xp.options.user')
      )
      .addIntegerOption((option) =>
        applyOptionDescription(
          option.setName('amount').setRequired(true).setMinValue(1).setMaxValue(1_000_000),
          'leveling.xp.options.amount'
        )
      )
  )
  .addSubcommand((sub) =>
    applyCommandDescription(sub.setName('reset'), 'leveling.xp.reset.description').addUserOption(
      (option) =>
        applyOptionDescription(option.setName('user').setRequired(true), 'leveling.xp.options.user')
    )
  );
