import SwiftUI
import FirebaseAuth

struct ProfileTabView: View {
    @EnvironmentObject var authViewModel: AuthenticationViewModel

    private var user: User? {
        Auth.auth().currentUser
    }

    var body: some View {
        VStack {
            Text("Your account and settings")
                .font(Constants.Typography.mediumRegular)
                .foregroundColor(Constants.ForegroundSecondary)
            
            if let name = user?.displayName {
                Text(name)
            }
            if let email = user?.email {
                Text(email)
            }
            
            Button("Sign Out") {
                authViewModel.signOut()
            }
        }
        .navigationTitle("Profile")
        .toolbarTitleDisplayMode(.inlineLarge)
    }
}
