import useBriefing from '../hooks/useBriefing';
import BriefingHeader from '../components/briefing/BriefingHeader';
import BriefingSummary from '../components/briefing/BriefingSummary';
import PickSetCard from '../components/briefing/PickSetCard';
import BriefingEmpty from '../components/briefing/BriefingEmpty';
import CuratorUsageFooter from '../components/briefing/CuratorUsageFooter';

export default function BriefingTab() {
    const { briefing, loading, error, regenerating, regenerate } = useBriefing();

    if (loading) return <div className="briefing-empty"><p>로딩 중...</p></div>;
    if (!briefing) return <BriefingEmpty regenerating={regenerating} onRegenerate={regenerate} error={error} />;

    return (
        <div className="briefing-tab">
            <BriefingHeader briefing={briefing} regenerating={regenerating} onRegenerate={regenerate} />
            <BriefingSummary narrative={briefing.narrative} />
            <div className="briefing-picks">
                <h3>이번 주 5세트</h3>
                {briefing.picks.map((p, i) => <PickSetCard key={i} pick={p} index={i} />)}
            </div>
            <CuratorUsageFooter />
        </div>
    );
}
