import { CustomCommandStatus, system } from "@minecraft/server";
import { fetchDatabase } from "../../functions/database/fetch-database";
export function dbDeleteCmd(_origin, targetDatabase, value) {
    const entity = _origin.sourceEntity;
    const sender = entity;
    system.run(() => {
        let db;
        try {
            db = fetchDatabase(targetDatabase);
        }
        catch (err) {
            sender.sendMessage(`§4[ReplayCraft]§cDatabase "${targetDatabase}" not found or invalid.`);
            return;
        }
        db.delete(value);
        sender.sendMessage(`§4[ReplayCraft]§aDeleted entry with key "${value}" from ${targetDatabase}.`);
    });
    return {
        status: CustomCommandStatus.Success,
        message: "",
    };
}
