import React from 'react';
import ReactDOM from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import { Toaster } from 'sonner';
import App from './App.jsx';
import { config } from './lib/config';
import { api } from './api/client';
import { attachMocks } from './api/mocks';
import './styles/index.css';

if (config.mockMode) {
  console.info('[mocks] VITE_MOCK_MODE=true → API simulada. Usuarios demo:');
  console.info('  admin / Admin#2026   gerente / Gerente#2026   cajero1 / Cajero#2026   auditor / Auditor#2026   mperez / Socio#2026');
  attachMocks(api);
}

ReactDOM.createRoot(document.getElementById('root')).render(
  <React.StrictMode>
    <BrowserRouter>
      <App />
      <Toaster richColors position="top-right" />
    </BrowserRouter>
  </React.StrictMode>
);
