#!/usr/bin/env node
/**
 * Supprimer toutes les notes créées
 */

import { PrismaClient } from '@prisma/client';

const prisma = new PrismaClient({
  datasources: {
    db: { url: 'file:/Users/sepehr/dev/Keep/memento-note/prisma/dev.db' },
  },
});

async function deleteNotes() {
  console.log('🗑️ Suppression des notes créées...\n');

  // Trouver le notebook "Documentation"
  const notebook = await prisma.notebook.findFirst({
    where: { name: 'Documentation' },
  });

  if (!notebook) {
    console.log('❌ Notebook "Documentation" non trouvé');
    return;
  }

  // Supprimer toutes les notes de ce notebook
  const result = await prisma.note.deleteMany({
    where: {
      notebookId: notebook.id,
    },
  });

  console.log(`✅ ${result.count} notes supprimées`);
}

deleteNotes()
  .catch(console.error)
  .finally(() => prisma.$disconnect());
