'use client';

import StoryWorkflow from '@/components/StoryWorkflow';
import { useProjectContext } from '@/providers/ProjectProvider';
import { useRouter } from 'next/navigation';

export default function WorkflowPage() {
    const { project, projectId, updateProject } = useProjectContext();
    const router = useRouter();

    return (
        <StoryWorkflow
            data={project.workflow || { nodes: [], connections: [] }}
            onUpdate={(workflow) => updateProject({ workflow })}
            entities={project.entities || []}
            onNavigateToEntity={() => router.push(`/project/${projectId}/world`)}
        />
    );
}
