import { request, paramsSerializer } from '@/utils/request.js';

// product-list
export const productListApi = (data) =>
  request({
    url: '/api/admin/tb/product/list',
    params: data,
    // method: 'get',
  });

// dispatch-manage
export const dispatchQueryApi = (data) =>
  request({
    url: '/api/admin/tb/crm/query',
    params: data,
  });
export const dispatchEditApi = (data) =>
  request({
    url: '/api/admin/tb/crm/save',
    data,
  });
export const dispatchDetailApi = (id) =>
  request({
    url: '/api/admin/tb/crm/get',
    params: { id },
    // method: 'get',
  });
export const dispatchDeleteApi = (id) =>
  request({
    url: '/api/admin/tb/crm/delete',
    params: { id },
  });
export const dispatchBatchDisableApi = (crmIds) =>
  request({
    url: '/api/admin/tb/crm/batchDisable',
    params: { crmIds },
    paramsSerializer,
  });
export const dispatchBatchZoneApi = (data) =>
  request({
    url: '/api/admin/tb/crm/batchZone',
    params: data,
  });
export const dispatchCountWaitZoneApi = (data) =>
  request({
    url: '/api/admin/tb/crm/countWaitZone',
    params: data,
    // method: 'get',
  });

// unit-manage
export const serviceUnitQueryApi = (data) =>
  request({
    url: '/api/service/service/unit/page',
    params: data,
  });
export const serviceUnitListApi = (data) =>
  request({
    url: '/api/admin/common/query_service_unit',
    params: data,
    paramsSerializer,
  });
export const serviceUnitEditApi = (data) =>
  request({
    url: '/api/service/service/unit/edit',
    data,
  });
export const serviceUnitPublishApi = (id) =>
  request({
    url: '/api/service/service/unit/publish',
    params: { id },
  });
export const serviceUnitClozeApi = (id) =>
  request({
    url: '/api/service/service/unit/cloze',
    params: { id },
  });
export const serviceUnitRestartApi = (id) =>
  request({
    url: '/api/service/service/unit/restart',
    params: { id },
  });
export const serviceUnitCancelApi = (id) =>
  request({
    url: '/api/service/service/unit/cancel',
    params: { id },
  });

// range-manage
export const serviceScopeQueryApi = (data) =>
  request({
    url: '/api/service/service/scope/page',
    params: data,
  });
export const serviceScopeUnbindCrmQueryApi = (data) =>
  request({
    url: '/api/service/service/scope/unbind/page',
    params: data,
  });
export const serviceScopeSubTotalApi = (data) =>
  request({
    url: '/api/service/service/scope/subTotal',
    params: data,
  });
export const serviceScopeBindBatchApi = (data) =>
  request({
    url: '/api/service/service/scope/bind_batch',
    data,
  });
export const serviceScopeUnbindApi = (crmId) =>
  request({
    url: '/api/service/service/scope/unbind',
    params: { crmId },
  });

// regional-planning
export const serviceRegionQueryApi = (data) =>
  request({
    url: '/api/service/service/region/page',
    params: data,
  });
export const serviceRegionEditApi = (data) =>
  request({
    url: '/api/service/service/region/edit',
    data,
  });
export const serviceRegionRemoveApi = (serviceRegionId) =>
  request({
    url: '/api/service/service/region/remove',
    params: { serviceRegionIdList: serviceRegionId },
    paramsSerializer,
  });
