import { getJson, sendJson } from '@/services/httpClient'
import type { AuthLoginRequest, AuthLoginResult, AuthLogoutResult, AuthMeResult } from '@/types/auth'

export function loginAuth(request: AuthLoginRequest): Promise<AuthLoginResult> {
  return sendJson<AuthLoginResult>('/api/auth/login', 'POST', request)
}

export function fetchCurrentAuth(): Promise<AuthMeResult> {
  return getJson<AuthMeResult>('/api/auth/me')
}

export function logoutAuth(): Promise<AuthLogoutResult> {
  return sendJson<AuthLogoutResult>('/api/auth/logout', 'POST')
}
