import { get, post } from '@/utils/request'
import type { ApiResponse, LoginParams, LoginResponse, AdminInfo, ChangePasswordRequest } from '@/types'

// 登录
export function login(data: LoginParams): Promise<ApiResponse<LoginResponse>> {
  return post('/admin/auth/login', data)
}

// 获取当前用户信息
export function getInfo(): Promise<ApiResponse<AdminInfo>> {
  return get('/admin/auth/info')
}

// 退出登录
export function logout(): Promise<ApiResponse<null>> {
  return post('/admin/auth/logout')
}

// 修改密码
export function changePassword(data: ChangePasswordRequest): Promise<ApiResponse<null>> {
  return post('/admin/auth/password', data)
}
