import { apiClient } from './api-client';
import type { UserProfile } from './auth-api';

export interface AgentProfile {
  id: string;
  email: string | null;
  phone: string;
  fullName: string;
  avatarUrl: string | null;
  role: string;
  kycStatus: string;
  isActive: boolean;
  createdAt: string;
  licenseNumber: string | null;
  agency: string | null;
  qualityScore: number | null;
  serviceAreas: string[];
  isVerified: boolean;
}

export interface UpdateProfilePayload {
  fullName?: string;
  email?: string;
  phone?: string;
}

export const profileApi = {
  getProfile: () => apiClient.get<UserProfile>('/auth/profile'),

  getAgentProfile: () => apiClient.get<AgentProfile | null>('/auth/profile/agent'),

  updateProfile: (data: UpdateProfilePayload) =>
    apiClient.patch<{ message: string }>('/auth/profile', data),
};
