import request from '@/utils/request';
import type { ApiResult } from '@/api';
import { MODULES_API_URL } from '@/config/setting';

export async function stopReplace(data: any) {
  const res = await request.post<ApiResult<unknown>>(
    MODULES_API_URL + '/led/bme/stop-replace',
    data
  );
  if (res.data.code === 0) {
    const data = res.data.data;
    return data || [];
  }
  return Promise.reject(new Error(res.data.message));
}

export async function numberReplace(data: any) {
  const res = await request.post<ApiResult<unknown>>(
    MODULES_API_URL + '/led/bme/number-sources',
    data
  );
  if (res.data.code === 0) {
    const data = res.data.data;
    return data || [];
  }
  return Promise.reject(new Error(res.data.message));
}
