'use server' import { paragraphRefactorService, RefactorMode, RefactorResult } from '@/lib/ai/services/paragraph-refactor.service' export interface RefactorResponse { result: RefactorResult } /** * Refactor a paragraph with a specific mode */ export async function refactorParagraph( content: string, mode: RefactorMode ): Promise { try { const result = await paragraphRefactorService.refactor(content, mode) return { result } } catch (error) { console.error('Error refactoring paragraph:', error) throw error } } /** * Get all 3 refactor options at once */ export async function refactorParagraphAllModes( content: string ): Promise<{ results: RefactorResult[] }> { try { const results = await paragraphRefactorService.refactorAllModes(content) return { results } } catch (error) { console.error('Error refactoring paragraph in all modes:', error) throw error } } /** * Validate word count before refactoring */ export async function validateRefactorWordCount( content: string ): Promise<{ valid: boolean; error?: string }> { return paragraphRefactorService.validateWordCount(content) }