/**
 * Users API Service
 * Action 6.1.1.3: Create users API service
 * Service layer for user-related API operations
 * Wraps existing user API functions into a unified service object
 */

import {
  getProfile,
  getProfileByUsername,
  updateProfile,
  calculateProfileCompletion,
  followUser,
  unfollowUser,
  getFollowers,
  getFollowing,
  type UserProfile,
  type UpdateProfileRequest,
  type ProfileCompletion,
  type FollowUserResponse,
  type UserFollowersResponse,
  type UserFollowingResponse,
} from '@/features/profile/services/profileService';
import {
  getSettings,
  updateSettings,
  type UserSettings,
  type UpdateSettingsRequest,
} from '@/features/settings/services/settingsService';
import {
  uploadAvatar,
  deleteAvatar,
  type UploadAvatarResponse,
} from '@/features/profile/services/avatarService';

/**
 * Users API Service Object
 * Action 6.1.1.3: Exports unified usersApi object with all user operations
 */
export const usersApi = {
  /**
   * Get user profile by ID
   */
  getProfile,

  /**
   * Get user profile by username
   */
  getProfileByUsername,

  /**
   * Update user profile
   */
  updateProfile,

  /**
   * Calculate profile completion percentage
   */
  calculateProfileCompletion,

  /**
   * Follow a user
   */
  follow: followUser,

  /**
   * Unfollow a user
   */
  unfollow: unfollowUser,

  /**
   * Get user followers
   */
  getFollowers,

  /**
   * Get users that a user is following
   */
  getFollowing,

  /**
   * Get user settings
   */
  getSettings,

  /**
   * Update user settings
   */
  updateSettings,

  /**
   * Upload user avatar
   */
  uploadAvatar,

  /**
   * Delete user avatar
   */
  deleteAvatar,
};

// Re-export types for convenience
export type {
  UserProfile,
  UpdateProfileRequest,
  ProfileCompletion,
  FollowUserResponse,
  UserFollowersResponse,
  UserFollowingResponse,
  UserSettings,
  UpdateSettingsRequest,
  UploadAvatarResponse,
};
