import apiClient from "@/services/api.client";
import { API_ENDPOINTS } from "@/lib/constants/apiEndpoints";
import type {
  LoginPayload,
  RegisterPayload,
  AuthApiResponse,
} from "@/types/api/auth.types";

export const authService = {
  login: (payload: LoginPayload) =>
    apiClient
      .post<AuthApiResponse>(API_ENDPOINTS.LOGIN, payload)
      .then((r) => r.data),

  register: (payload: RegisterPayload) =>
    apiClient
      .post<AuthApiResponse>(API_ENDPOINTS.REGISTER, payload)
      .then((r) => r.data),

  logout: () =>
    apiClient.post(API_ENDPOINTS.LOGOUT).then((r) => r.data),
};
