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

export const backupCommandData = applyCommandDescription(
  new SlashCommandBuilder()
    .setName('backup')
    .setDefaultMemberPermissions(PermissionFlagsBits.ManageGuild)
    .addSubcommand((s) =>
      applyCommandDescription(s.setName('create'), 'guildbackup.create.description').addStringOption(
        (o) => applyOptionDescription(o.setName('name'), 'guildbackup.create.options.name')
      )
    )
    .addSubcommand((s) => applyCommandDescription(s.setName('list'), 'guildbackup.list.description'))
    .addSubcommand((s) =>
      applyCommandDescription(s.setName('info'), 'guildbackup.info.description').addStringOption(
        (o) =>
          applyOptionDescription(o.setName('id').setRequired(true), 'guildbackup.common.options.id')
      )
    )
    .addSubcommand((s) =>
      applyCommandDescription(s.setName('delete'), 'guildbackup.delete.description').addStringOption(
        (o) =>
          applyOptionDescription(o.setName('id').setRequired(true), 'guildbackup.common.options.id')
      )
    )
    .addSubcommand((s) =>
      applyCommandDescription(s.setName('restore'), 'guildbackup.restore.description').addStringOption(
        (o) =>
          applyOptionDescription(o.setName('id').setRequired(true), 'guildbackup.common.options.id')
      )
    ),
  'guildbackup.description'
);
