//@ts-nocheck
import { useNavigation } from '@react-navigation/native';
import { observer } from 'mobx-react-lite';
import React from 'react';
import { Platform, SafeAreaView, View } from 'react-native';
import Pdf from 'react-native-pdf';
import { IconBack } from '../../assets/icons';
import MButton from '../../components/MButton';
import { MText } from '../../components/MText';
import { color } from '../../theme';
import { commonStyles } from '../CommonStyles';
import MHeader from '../../components/MHeader';

export const QuickTerm = observer(function QuickTerm(props: any) {
  const navigation = useNavigation();
  const source = {
    uri: props.route.params.fullSubmit
      ? 'bundle-assets://pdf/full.pdf'
      : 'bundle-assets://pdf/quick.pdf',
    cache: true,
  };

  return (
    <View style={{ flex: 1, backgroundColor: 'white' }}>
      <MHeader
        title="T&C_Điều khoản và điều kiện"
        onBack={() => {
          navigation.goBack();
        }}
      />
      <SafeAreaView style={{ flex: 1 }}>
        <Pdf
          trustAllCerts={false}
          source={
            props?.route.params.fullSubmit
              ? {
                  uri: 'https://upl.tima.vn/uploads/cimb/TIMA_Cashloan_TnC.pdf',
                }
              : {
                  uri: 'https://upl.tima.vn/uploads/cimb/GENERAL_TERMS_AND_CONDITIONS.pdf',
                }
          }
          style={[commonStyles.fill, { marginTop: 8 }]}
          onError={(error) => {
            console.log(error);
          }}
        />
      </SafeAreaView>
    </View>
  );
});
