'use client' import { createContext, useContext, useState, useEffect, useMemo, useCallback } from 'react' import type { Notebook, Label, Note } from '@/lib/types' // ===== INPUT TYPES ===== export interface CreateNotebookInput { name: string icon?: string color?: string } export interface UpdateNotebookInput { name?: string icon?: string color?: string } export interface CreateLabelInput { name: string color?: string notebookId: string } export interface UpdateLabelInput { name?: string color?: string } // ===== CONTEXT VALUE ===== export interface NotebooksContextValue { // État global notebooks: Notebook[] currentNotebook: Notebook | null // null = "Notes générales" currentLabels: Label[] // Labels du notebook actuel isLoading: boolean error: string | null // Actions: Notebooks createNotebookOptimistic: (data: CreateNotebookInput) => Promise updateNotebook: (notebookId: string, data: UpdateNotebookInput) => Promise deleteNotebook: (notebookId: string) => Promise updateNotebookOrderOptimistic: (notebookIds: string[]) => Promise setCurrentNotebook: (notebook: Notebook | null) => void // Actions: Labels createLabel: (data: CreateLabelInput) => Promise