import type { LoginRequest, LoginResponse, RefreshResponse } from '../types/auth';
import { api } from './api';

export const authService = {
  async login(phone: string, password: string): Promise<LoginResponse> {
    const body: LoginRequest = { phone, password };
    return api.post<LoginResponse>('/auth/login', body);
  },

  async refresh(refreshToken: string): Promise<RefreshResponse> {
    return api.post<RefreshResponse>('/auth/refresh', { refreshToken });
  },

  async logout(): Promise<void> {
    return api.post<void>('/auth/logout');
  },
};
