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 = '1';
  const clientCode = 'spt';
  const userToken =
    'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzY29wZSI6InNlcnZlci10by1zZXJ2ZXIiLCJmcmFtZXdvcmstYXBpIjp0cnVlLCJjb21wYW55X2NvZGUiOiJTUFQiLCJzdWIiOjE1NTcsImlzcyI6Imh0dHBzOi8vc3B0ZXN0LmNvbW11ZGVzay5jb20vYXBpL2ZyYW1ld29yay9vd25lci9hdXRoL2NsaWVudF9hdXRoZW50aWNhdGlvbiIsImlhdCI6MTc2Nzc1MjU5OSwiZXhwIjoyMDgzMzIyMTE5LCJuYmYiOjE3Njc3NTI1OTksImp0aSI6IktEcmhmSXgzeWU0WmxaUEYifQ.Bv4ZSjGRm9YYOjGItLSV_3wS7grKuPTabL60BFnp88o';
  
    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;
