import { request } from '@/plugins/http-fetch';

/**
 * 首次引导开始
 * @returns object
 */
export function bootloaderStart() {
  return request({
    url: `/bootloader`,
    method: 'POST',
    whithToken: false,
    repeatSubmit: false,
  });
}

/**
 * 首次引导完成
 * @returns object
 */
export function bootloaderDone() {
  return request({
    url: `/bootloader`,
    method: 'PUT',
  });
}

/**
 * 引导系统数据重置
 * @returns object
 */
export function bootloaderReset() {
  return request({
    url: `/bootloader`,
    method: 'DELETE',
    timeout: 180_000
  });
}

/**
 * 管理员账号变更
 * @returns object
 */
export function bootloaderAccount(username: string, password: string) {
  return request({
    url: `/bootloader/account`,
    method: 'PUT',
    data: {
      username,
      password,
    },
  });
}
