/**
 * 用户主页 UserScreen
 * 胡萝卜BBS - 查看其他用户资料
 * 使用统一的 UserProfileScreen 组件，mode='other'
 */

import React from 'react';
import { useRoute, RouteProp } from '@react-navigation/native';
import UserProfileScreen from './UserProfileScreen';
import { HomeStackParamList } from '../../navigation/types';
import { useCurrentUser } from '../../stores/authStore';

type UserRouteProp = RouteProp<HomeStackParamList, 'UserProfile'>;

export const UserScreen: React.FC = () => {
  const route = useRoute<UserRouteProp>();
  const userId = route.params?.userId || '';
  const currentUser = useCurrentUser();
  const isSelfProfile = !!currentUser?.id && currentUser.id === userId;
  
  return (
    <UserProfileScreen
      mode={isSelfProfile ? 'self' : 'other'}
      userId={isSelfProfile ? undefined : userId}
    />
  );
};

export default UserScreen;
