/**
 * @license
 * SPDX-License-Identifier: Apache-2.0
 */

import React from 'react';
import { Project } from '../../types';
import { PjtDashboard } from '../pjt/PjtDashboard';
import { PjtBasic } from '../pjt/PjtBasic';
import { PjtOrganization } from '../pjt/PjtOrganization';
import { PjtQuestions } from '../pjt/PjtQuestions';
import { PjtDistribution } from '../pjt/PjtDistribution';

interface OpsProjectProps {
  project: Project;
  tab?: 'dashboard' | 'basic' | 'organization' | 'questions' | 'distribution';
  onUpdateProject?: (updated: Project) => void;
}

export const OpsProject: React.FC<OpsProjectProps> = ({
  project,
  tab = 'dashboard',
  onUpdateProject = () => { },
}) => {
  switch (tab) {
    case 'dashboard':
      return <PjtDashboard project={project} />;
    case 'basic':
      return <PjtBasic project={project} onUpdateProject={onUpdateProject} />;
    case 'organization':
      return <PjtOrganization project={project} onUpdateProject={onUpdateProject} />;
    case 'questions':
      return <PjtQuestions project={project} onUpdateProject={onUpdateProject} />;
    case 'distribution':
      return <PjtDistribution project={project} onUpdateProject={onUpdateProject} />;
    default:
      return <PjtDashboard project={project} />;
  }
};
