import http from '../utils/http';
import config from '../config/config';

/**
 * 获取打印机列表
 * @author Seven
 * @data 2025-4-5
 * @param {
 *  keyword: "",
 *  pageNum: 1,
 *  pageSize: 20,
 * }
 * @returns {  }
 * @see https://mall.gpxscs.cn/api/admin/shop/store/printer/page
 */

export function GetPrinterList(params) {
  return http({
    url: '/shop/store/printer/page',
    method: 'get',
    params,
    baseURL: config.adminApi,
  });
}

/**
 * 获取打印机区域列表 打印来源
 * @author Seven
 * @data 2025-4-5
 * @param { count: 99 }
 * @returns {  }
 * @see https://mall.gpxscs.cn/api/admin/shop/store/printer/region/list
 */

export function GetPrinterflagList(params) {
  return http({
    url: '/shop/store/printer/region/list',
    method: 'get',
    params,
    baseURL: config.adminApi,
  });
}

/**
 * 获取打印机品牌列表
 * @author Seven
 * @data 2025-4-5
 * @param { count: 99 }
 * @returns {  }
 * @see https://mall.gpxscs.cn/api/admin/shop/store/printer/model/list
 */

export function GetPrinterModelList(params) {
  return http({
    url: '/shop/store/printer/model/list',
    method: 'get',
    params,
    baseURL: config.adminApi,
  });
}

/**
 * 添加打印机
 * @author Seven
 * @data 2025-4-5
 * @param {
 *  printer_name: "", 打票机备注名
 *  model_id: "",     打票机型号ID
 *  printer_sn: "",   打票机编号
 *  printer_key: "",  打票机密钥
 *  website_url: "",  打印机官网网址
 *  region: 0,        打票机摆放区域ID
 *  paper_with: 58,   纸张宽度 58 和 80
 * }
 * @returns {  }
 * @see https://mall.gpxscs.cn/api/admin/shop/store/printer/add/new
 */

export function AddPrinter(params) {
  return http({
    url: '/shop/store/printer/add/new',
    method: 'post',
    params,
    baseURL: config.adminApi,
  });
}

/**
 * 删除打印机
 * @author Seven
 * @data 2025-4-5
 * @param { printer_id:0}  打票机自增ID
 * @returns {  }
 * @see https://mall.gpxscs.cn/api/admin/shop/store/printer/delete
 */

export function DelectPrinter(params) {
  return http({
    url: '/shop/store/printer/delete',
    method: 'post',
    params,
    baseURL: config.adminApi,
  });
}

/**
 * 更新打印机
 * @author Seven
 * @data 2025-4-5
 * @param  { printer_id:0}  打票机自增ID
 * @returns {  }
 * @see https://mall.gpxscs.cn/api/admin/shop/store/printer/update
 */

export function UpdatePrinter(params) {
  return http({
    url: '/shop/store/printer/update',
    method: 'post',
    params,
    baseURL: config.adminApi,
  });
}

/**
 * 更新打印机状态
 * @author Seven
 * @data 2025-4-5
 * @param  {
 *    printer_id:0, 打票机自增ID
 *    status:1      状态：1-开启；2-关闭；
 * }
 * @returns {  }
 * @see https://mall.gpxscs.cn/api/admin/shop/store/printer/status/update'
 */

export function UpdatePrinterStatus(params) {
  return http({
    url: '/shop/store/printer/status/update',
    method: 'post',
    params,
    baseURL: config.adminApi,
  });
}

/**
 * 测试打印机
 * @author Seven
 * @data 2025-4-5
 * @param  {orderId}  DD-20241112-1
 * @returns {  }
 * @see https://mall.gpxscs.cn/api/admin/shop/store/printer/print/order
 */

export function TestPrinter(params) {
  return http({
    url: 'shop/store/printer/print/order',
    method: 'post',
    params,
    baseURL: config.adminApi,
  });
}
