import { NextResponse } from 'next/server';

export async function POST(request: Request) {
  try {
    const { tabId, tabName, apiKey } = await request.json();
    
    if (!apiKey) {
      return NextResponse.json({ error: 'API key required' }, { status: 400 });
    }

    // For now, return instructions for manual spawn
    // Real implementation would use sessions_spawn via OpenClaw SDK
    const sessionKey = `claude-${tabId}-${Date.now()}`;
    
    return NextResponse.json({
      success: true,
      sessionId: sessionKey,
      sessionKey,
      message: `To start Claude Code for ${tabName}, use the spawn command in Horus`,
      instruction: `Ask Horus to spawn a Claude session for ${tabName}`
    });
  } catch (error) {
    return NextResponse.json({ error: 'Failed to spawn session' }, { status: 500 });
  }
}
