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

export const voiceCommandData = applyCommandDescription(
  new SlashCommandBuilder()
    .setName('voice')
    .addSubcommand((s) =>
      applyCommandDescription(s.setName('setup'), 'tempvoice.setup.description')
        .addChannelOption((o) =>
          applyOptionDescription(
            o.setName('hub_channel').addChannelTypes(ChannelType.GuildVoice).setRequired(true),
            'tempvoice.setup.options.hub_channel'
          )
        )
        .addChannelOption((o) =>
          applyOptionDescription(
            o.setName('category').addChannelTypes(ChannelType.GuildCategory).setRequired(true),
            'tempvoice.setup.options.category'
          )
        )
        .addStringOption((o) =>
          applyOptionDescription(o.setName('default_name'), 'tempvoice.setup.options.default_name')
        )
        .addIntegerOption((o) =>
          applyOptionDescription(
            o.setName('limit').setMinValue(0).setMaxValue(99),
            'tempvoice.setup.options.limit'
          )
        )
    )
    .addSubcommand((s) =>
      applyCommandDescription(s.setName('rename'), 'tempvoice.rename.description')
        .addStringOption((o) =>
          applyOptionDescription(o.setName('name').setRequired(true), 'tempvoice.rename.options.name')
        )
    )
    .addSubcommand((s) =>
      applyCommandDescription(s.setName('limit'), 'tempvoice.limit.description')
        .addIntegerOption((o) =>
          applyOptionDescription(
            o.setName('limit').setRequired(true).setMinValue(0).setMaxValue(99),
            'tempvoice.limit.options.limit'
          )
        )
    )
    .addSubcommand((s) => applyCommandDescription(s.setName('lock'), 'tempvoice.lock.description'))
    .addSubcommand((s) => applyCommandDescription(s.setName('hide'), 'tempvoice.hide.description'))
    .addSubcommand((s) =>
      applyCommandDescription(s.setName('kick'), 'tempvoice.kick.description')
        .addUserOption((o) =>
          applyOptionDescription(o.setName('user').setRequired(true), 'tempvoice.kick.options.user')
        )
    )
    .addSubcommand((s) =>
      applyCommandDescription(s.setName('transfer'), 'tempvoice.transfer.description')
        .addUserOption((o) =>
          applyOptionDescription(o.setName('user').setRequired(true), 'tempvoice.transfer.options.user')
        )
    )
    .addSubcommand((s) => applyCommandDescription(s.setName('claim'), 'tempvoice.claim.description'))
    .addSubcommand((s) => applyCommandDescription(s.setName('panel'), 'tempvoice.panel.description')),
  'tempvoice.description'
);
