import { Result } from "../Result"; /** * Mutation Contract * * Purpose: Framework-agnostic write operations * * Rules: * - Orchestrates services for writes * - No HTTP/API calls directly * - No 'use client' directive * - No 'use server' directive * - Must be in lib/mutations/ * - Must be named *Mutation * - Can be called from Server Actions * - Single responsibility: ONE operation per mutation * * Pattern: * Server Action → Mutation → Service → API Client * * Design Principle: * Each mutation does ONE thing. If you need multiple operations, * create multiple mutation classes (e.g., UpdateUserStatusMutation, DeleteUserMutation). * This follows the same pattern as Page Queries. */ export interface Mutation { /** * Execute the mutation * * @param input - Mutation input * @returns Result indicating success or error */ execute(input: TInput): Promise>; }