import { Admin, Resource } from 'react-admin';
import { dataProvider } from './dataProvider';
import { authProvider } from './authProvider';
import { EquipmentList } from './resources/equipment/EquipmentList';
import { EquipmentEdit } from './resources/equipment/EquipmentEdit';
import { EquipmentCreate } from './resources/equipment/EquipmentCreate';
import { EquipmentShow } from './resources/equipment/EquipmentShow';
import { ChangeEquipmentStatusList } from './resources/change-equipment-status/ChangeEquipmentStatusList';
import { ChangeEquipmentStatusEdit } from './resources/change-equipment-status/ChangeEquipmentStatusEdit';
import { ChangeEquipmentStatusCreate } from './resources/change-equipment-status/ChangeEquipmentStatusCreate';
import { ChangeEquipmentStatusShow } from './resources/change-equipment-status/ChangeEquipmentStatusShow';
import { initKeycloak } from './authProvider';

// Initialize Keycloak before rendering Admin
initKeycloak();

const App = () => (
  <Admin dataProvider={dataProvider} authProvider={authProvider}>
    <Resource
      name="equipment"
      list={EquipmentList}
      create={EquipmentCreate}
      edit={EquipmentEdit}
      show={EquipmentShow}
    />
    <Resource
      name="change-equipment-status"
      list={ChangeEquipmentStatusList}
      create={ChangeEquipmentStatusCreate}
      edit={ChangeEquipmentStatusEdit}
      show={ChangeEquipmentStatusShow}
    />
  </Admin>
);

export default App;