
import React from 'react';
import { Language } from '../../types';
import { useTracker } from './useTracker';
import IdleView from './IdleView';
import SporadicView from './SporadicView';
import ActiveSessionView from './ActiveSessionView';

interface TrackerProps {
    lang: Language;
}

const Tracker: React.FC<TrackerProps> = ({ lang }) => {
    const tracker = useTracker({}); // No props needed, hook uses context
    const { activeSession, isSporadicMode, onSessionEnd, onSessionQuit, onRemoveSet } = tracker;

    if (activeSession) {
        return (
            <ActiveSessionView
                tracker={tracker}
                activeSession={activeSession}
                lang={lang}
                onSessionEnd={onSessionEnd}
                onSessionQuit={onSessionQuit}
                onRemoveSet={onRemoveSet}
            />
        );
    }

    if (isSporadicMode) {
        return <SporadicView tracker={tracker} lang={lang} />;
    }

    return <IdleView tracker={tracker} lang={lang} />;
};

export default Tracker;
