import type { PersonalityQuizWorkflow } from '@/components/personality-quiz/types';
import { PersonalityLanguagePanel } from '@/components/personality-quiz/PersonalityLanguagePanel';
import { PersonalityOverviewPanel } from '@/components/personality-quiz/PersonalityOverviewPanel';
import { PersonalityRelationshipsPanel } from '@/components/personality-quiz/PersonalityRelationshipsPanel';
import { PersonalityResultActions } from '@/components/personality-quiz/PersonalityResultActions';
import { PersonalityResultHeader } from '@/components/personality-quiz/PersonalityResultHeader';
import { PersonalityResultTabs } from '@/components/personality-quiz/PersonalityResultTabs';

interface PersonalityResultViewProps {
  readonly workflow: PersonalityQuizWorkflow;
  readonly onViewDirectory: () => void;
  readonly savedDate?: string | null;
  readonly isSaving: boolean;
}

export function PersonalityResultView({
  workflow,
  onViewDirectory,
  savedDate,
  isSaving,
}: PersonalityResultViewProps) {
  if (!workflow.result) {
    return null;
  }

  return (
    <div className="bg-slate-800/40 backdrop-blur-sm rounded-2xl border border-slate-700/40 overflow-hidden">
      <PersonalityResultHeader workflow={workflow} savedDate={savedDate} isSaving={isSaving} />
      <PersonalityResultTabs workflow={workflow} />

      <div className="p-6">
        {workflow.activeResultTab === 'overview' && <PersonalityOverviewPanel workflow={workflow} />}
        {workflow.activeResultTab === 'relationships' && <PersonalityRelationshipsPanel workflow={workflow} />}
        {workflow.activeResultTab === 'language' && <PersonalityLanguagePanel workflow={workflow} />}
        <PersonalityResultActions workflow={workflow} onViewDirectory={onViewDirectory} />
      </div>
    </div>
  );
}
