import {
  Constants,
  type ApplicationCommandOptions,
  type ApplicationCommandOptionsBoolean,
  type ApplicationCommandOptionsInteger,
  type ApplicationCommandOptionsMentionable,
  type ApplicationCommandOptionsNumber,
  type ApplicationCommandOptionsRole,
  type ApplicationCommandOptionsString,
  type ApplicationCommandOptionsSubCommand,
  type ApplicationCommandOptionsSubCommandGroup,
  type ApplicationCommandOptionsUser,
} from '@projectdysnomia/dysnomia';

export type StringOptionDefinition = Omit<ApplicationCommandOptionsString, 'type'> & { autocomplete?: boolean };
export function stringOption(options: StringOptionDefinition): ApplicationCommandOptionsString {
  const def = options as ApplicationCommandOptionsString;
  def.type = Constants.ApplicationCommandOptionTypes.STRING;
  return def;
}
export type IntegerOptionDefinition = Omit<ApplicationCommandOptionsInteger, 'type'> & { autocomplete?: boolean };
export function integerOption(options: IntegerOptionDefinition): ApplicationCommandOptionsInteger {
  const def = options as ApplicationCommandOptionsInteger;
  def.type = Constants.ApplicationCommandOptionTypes.INTEGER;
  return def;
}
export type BooleanOptionDefinition = Omit<ApplicationCommandOptionsBoolean, 'type'>;
export function booleanOption(options: BooleanOptionDefinition): ApplicationCommandOptionsBoolean {
  const def = options as ApplicationCommandOptionsBoolean;
  def.type = Constants.ApplicationCommandOptionTypes.BOOLEAN;
  return def;
}
export type UserOptionDefinition = Omit<ApplicationCommandOptionsUser, 'type'> & { autocomplete?: boolean };
export function userOption(options: UserOptionDefinition): ApplicationCommandOptionsUser {
  const def = options as ApplicationCommandOptionsUser;
  def.type = Constants.ApplicationCommandOptionTypes.USER;
  return def;
}
export type ChannelOptionDefinition = Omit<ApplicationCommandOptions, 'type'> & { autocomplete?: boolean };
export function channelOption(options: ChannelOptionDefinition): ApplicationCommandOptions {
  const def = options as ApplicationCommandOptions;
  def.type = Constants.ApplicationCommandOptionTypes.CHANNEL;
  return def;
}
export type RoleOptionDefinition = Omit<ApplicationCommandOptionsRole, 'type'> & { autocomplete?: boolean };
export function roleOption(options: RoleOptionDefinition): ApplicationCommandOptionsRole {
  const def = options as ApplicationCommandOptionsRole;
  def.type = Constants.ApplicationCommandOptionTypes.ROLE;
  return def;
}
export type MentionableOptionDefinition = Omit<ApplicationCommandOptionsMentionable, 'type'>;
export function mentionableOption(options: MentionableOptionDefinition): ApplicationCommandOptionsMentionable {
  const def = options as ApplicationCommandOptionsMentionable;
  def.type = Constants.ApplicationCommandOptionTypes.MENTIONABLE;
  return def;
}
export type NumberOptionDefinition = Omit<ApplicationCommandOptionsNumber, 'type'> & { autocomplete?: boolean };
export function numberOption(options: NumberOptionDefinition): ApplicationCommandOptionsNumber {
  const def = options as ApplicationCommandOptionsNumber;
  def.type = Constants.ApplicationCommandOptionTypes.NUMBER;
  return def;
}
export type AttachmentOptionDefinition = Omit<ApplicationCommandOptions, 'type'>;
export function attachmentOption(options: AttachmentOptionDefinition): ApplicationCommandOptions {
  const def = options as ApplicationCommandOptions;
  def.type = Constants.ApplicationCommandOptionTypes.ATTACHMENT;
  return def;
}
export type SubCommandOptionDefinition = Omit<ApplicationCommandOptionsSubCommand, 'type'>;
export function subCommandOption(options: SubCommandOptionDefinition): ApplicationCommandOptionsSubCommand {
  const def = options as ApplicationCommandOptionsSubCommand;
  def.type = Constants.ApplicationCommandOptionTypes.SUB_COMMAND;
  return def;
}
export type SubCommandGroupOptionDefinition = Omit<ApplicationCommandOptionsSubCommandGroup, 'type'>;
export function subCommandGroupOption(options: SubCommandGroupOptionDefinition): ApplicationCommandOptionsSubCommandGroup {
  const def = options as ApplicationCommandOptionsSubCommandGroup;
  def.type = Constants.ApplicationCommandOptionTypes.SUB_COMMAND_GROUP;
  return def;
}
