import { useState } from 'react';
import { Layout } from './components/layout/Layout';
import { PlaceholderView } from './components/PlaceholderView';

import { LabelsView } from './components/labels/LabelsView';
import { TrainingView } from './components/training/TrainingView';
import { AlertsView } from './components/alerts/AlertsView';
import { ProductsView } from './components/products/ProductsView';
import { PeopleView } from './components/people/PeopleView';
import { ReportsView } from './components/reports/ReportsView';
import { LocationsView } from './components/locations/LocationsView';
import { DevicesView } from './components/devices/DevicesView';
import { InvoicesView } from './components/invoices/InvoicesView';
import { QRCodesView } from './components/qrcodes/QRCodesView';
import { Dashboard } from './components/dashboard/Dashboard';

const blankViews = ['Tasks', 'Sensors', 'Food Waste', 'E-Label', 'API'];

export default function App() {
  const [currentView, setCurrentView] = useState('Dashboard');

  const renderView = () => {
    if (blankViews.includes(currentView)) {
      return <div className="min-h-[200px]" />;
    }
    switch (currentView) {
      case 'Dashboard':
        return <Dashboard />;
      case 'Training':
        return <TrainingView />;
      case 'Alerts':
        return <AlertsView />;
      case 'Menu Manager':
        return <ProductsView />;
      case 'Account Management':
        return <PeopleView />;
      case 'Reports':
        return <ReportsView />;
      case 'Location Manager':
        return <LocationsView />;
      case 'Devices':
        return <DevicesView />;
      case 'Invoices':
        return <InvoicesView />;
      case 'QR Codes':
        return <QRCodesView />;
      case 'Labels':
      case 'Label Categories':
      case 'Label Types':
      case 'Label Templates':
      case 'Multiple Options':
        return <LabelsView currentView={currentView} onViewChange={setCurrentView} />;
      default:
        return <PlaceholderView title={currentView} />;
    }
  };

  return (
    <Layout currentView={currentView} setCurrentView={setCurrentView}>
      {renderView()}
    </Layout>
  );
}
