/* Copyright (C) Click & Push Accessibility, Inc - All Rights Reserved
 * Unauthorized copying of this file, via any medium is strictly prohibited
 * Proprietary and confidential
 * Written and maintained by the Click & Push Development team 
 * <dev@clicknpush.ca>, January 2022
 */

import { observer } from "mobx-react"
import React from "react"
import { ImageBackground, Text } from "react-native"
import { useAuth } from "../../data/Auth/AuthContext"
import { BaseStackNavigationProp } from "../../navigation/BaseStackNavigator"
import LoginView from "./LoginView"
import Profile from "./Profile"
import { ProfileSectionHeader } from "./ProfileSections/ProfileSectionHeader"
import { ProfileMainStyles } from "./Styles/Profile.styles"
import * as Linking from 'expo-linking'

/**
 * The screen component that displays the user's profile. Gets user information from the {@link useProfile} hook.
 * @component
 */
const ProfileTemplate: React.FC<{navigation: BaseStackNavigationProp}> = ({navigation}) => {
    const {accessToken} = useAuth()

    const openFeedback = () => {
        Linking.openURL('mailto:dev@clicknpush.ca')
    }

    return (
        <ImageBackground source={require('../../../assets/cover.jpg')} style={ProfileMainStyles.profileMainContainer}>
            {accessToken ? <Profile /> : <LoginView navigation={navigation} />}
        </ImageBackground>
    )
}

export default observer(ProfileTemplate)
