import React, { useEffect } from 'react';
import {
  StatusBar,
  useColorScheme,
  SafeAreaView,
  View,
  BackHandler,
} from 'react-native';
// import { showPluginUI, QmsDashboardView } from 'QmsPlugin';
import { QmsDashboardView } from 'QmsPlugin';

function App() {
  const isDarkMode = useColorScheme() === 'dark';

  const clientID = '3';
  const clientCode = 'kita';
  const userToken =
    'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6ImF0aGlyYWh6YWlkaUBjb252ZXAuY29tIiwicGFzc3dvcmQiOiIkMnkkMTAkNU9xYklqMnZ6UHJwckJrcVd5c3I2LmJCc1hVYS9Hd014eUhnL3RhUUhPUkNQcGdmTG8yakciLCJzdWIiOjIxNzAsImlzcyI6Imh0dHBzOi8va2l0YWRldi5jb21tdWRlc2suY29tL2FwaS9vd25lci9hdXRoL3Bhc3N3b3JkbGVzc19sb2dpbiIsImlhdCI6MTc2MDMxNTM1MiwiZXhwIjoyMDc1ODg0ODcyLCJuYmYiOjE3NjAzMTUzNTIsImp0aSI6IktoQmNyQnJEdDVNdDZlWmMifQ.JnxGbZ7hTeoOr6oibIzZMphgyKtTo2Aq9Efx6mrGfFA';
  
    return (
    <SafeAreaView>
      <StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
      <View style={{ flex: 1 }}>
        <QmsDashboardView
          style={{ flex: 1 }}
          ClientID={clientID}
          ClientCode={clientCode}
          user_token={userToken}
          onClose={() => {
            // BackHandler.exitApp();
            console.log('Dashboard closed'); // { status: 'closed' }
          }}
        />
      </View>
    </SafeAreaView>
  );
}

export default App;
