import DiscordInteractionCommand, { DiscordInteractionCommandSkeleton } from "../../util/DiscordInteractionCommand";
import { guildID } from "../../config.json";
import { ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js";
import { MemberModel } from "../../database/Member";
import { PartnerModel } from "../../database/Partner";

export default class PartnerAdd implements DiscordInteractionCommandSkeleton {
    public GUILD_ID: string;
    public name: string;
    public description: string
    public builder: SlashCommandBuilder;
    constructor() {
        this.name = "partner";
        this.description = "Creates a new partner entry.";
        this.builder = new SlashCommandBuilder();
        this.GUILD_ID = guildID;
    }

    public async execute(interaction: ChatInputCommandInteraction) {
        const member = MemberModel.findOne({ discordID: interaction.user.id });
        if (!member) return interaction.reply({ content: "The specified partner does not have a base member entry.", ephemeral: true });
        if (!(await PartnerModel.findOne({discordID: interaction.user.id}))) return interaction.reply({ content: "The specified partner already has a partner entry.", ephemeral: true });

    }
}