import api from '@/core/api/axios';
import type { LoginRequest, LoginResponse, AuthUser } from '@/core/auth/auth.types';

const BASE = '/api/wtm/auth';

export const authApi = {
  login: (data: LoginRequest) => api.post<LoginResponse>(`${BASE}/login`, data),
  me: () => api.get<AuthUser>(`${BASE}/me/profile`),
  refresh: (refreshToken: string) => api.post(`${BASE}/refresh`, { refreshToken }),
  logout: () => api.post(`${BASE}/logout`),
  resetPassword: (email: string) => api.post(`${BASE}/password/reset`, { email }),
  changePassword: (data: { currentPassword: string; newPassword: string }) =>
    api.put(`${BASE}/password/change`, data),
};
