import { apiClient } from './apiClient'

interface AuthResponse {
  token: string
  expires_at: string
}

export interface AuthLoginPayload {
  username: string
  password: string
}

export const authService = {
  login: async (payload: AuthLoginPayload) => {
    const { data } = await apiClient.post<AuthResponse>('/v1/auth/login', payload)
    return { token: data.token, expiresAt: data.expires_at }
  },
  logout: async () => {
    await apiClient.post('/v1/auth/logout')
  }
}
