import request from '@/utils/request'
import type { AdminLoginRequest, AdminAuthResponse } from '@/types/admin'
import type { ApiResponse } from '@/types/common'

// 管理员登录
export function login(data: AdminLoginRequest) {
  return request<ApiResponse<AdminAuthResponse>>({
    url: '/admin/auth/login',
    method: 'post',
    data
  })
}

// 获取当前管理员信息
export function getAdminInfo() {
  return request({
    url: '/admin/auth/info',
    method: 'get'
  })
}

// 管理员登出
export function logout() {
  return request({
    url: '/admin/auth/logout',
    method: 'post'
  })
}

// 刷新Token
export function refreshToken(refreshToken: string) {
  return request({
    url: '/admin/auth/refreshToken',
    method: 'post',
    data: { refreshToken }
  })
}
