import { usePersonalityQuizWorkflow } from '@/business/personality/quizWorkflowHooks';
import { PersonalityQuizView } from '@/components/personality-quiz/PersonalityQuizView';

interface PersonalityQuizProps {
  readonly onViewDirectory: () => void;
  readonly onResult?: (code: string, answers: Record<number, string>) => void | Promise<void>;
  readonly savedType?: string | null;
  readonly savedAnswers?: Record<number, string> | null;
  readonly savedDate?: string | null;
  readonly isSaving?: boolean;
}

export default function PersonalityQuiz({
  onViewDirectory,
  onResult,
  savedType,
  savedAnswers,
  savedDate,
  isSaving = false,
}: PersonalityQuizProps) {
  const workflow = usePersonalityQuizWorkflow({
    onResult,
    savedType,
    savedAnswers,
  });

  return (
    <PersonalityQuizView
      workflow={workflow}
      onViewDirectory={onViewDirectory}
      savedDate={savedDate}
      isSaving={isSaving}
    />
  );
}
