import { NextResponse } from 'next/server';
import { getMorningSummaryService } from '@/lib/services/morning-summary-service';

export async function GET() {
  try {
    const service = getMorningSummaryService();
    const history = await service.getSummaryHistory(10);
    const latest = await service.getLatestSummaryRow();
    return NextResponse.json({ history, latest });
  } catch (error) {
    console.error('[GET /api/notifications/morning-summary/history]', error);
    return NextResponse.json({ error: String(error) }, { status: 500 });
  }
}
