import { http } from './request'
import type { LoginData, LoginResult } from '@/types'
import type { User } from '@/types/system'

export function login(data: LoginData): Promise<LoginResult> {
  return http.post('/auth/login', data)
}

export function logout(): Promise<void> {
  return http.post('/auth/logout')
}

export function getUserInfo(): Promise<User> {
  return http.get('/auth/info')
}

export function changePassword(oldPassword: string, newPassword: string): Promise<void> {
  return http.post('/auth/change-password', { oldPassword, newPassword })
}
