import request from '@/utils/request'

// 创建码规则
export function createBusinessRule(data) {
  return request({
    url: '/identity/business-rule/create',
    method: 'post',
    data: data
  })
}

// 更新码规则
export function updateBusinessRule(data) {
  return request({
    url: '/identity/business-rule/update',
    method: 'put',
    data: data
  })
}

// 删除码规则
export function deleteBusinessRule(id) {
  return request({
    url: '/identity/business-rule/delete?id=' + id,
    method: 'delete'
  })
}

// 获得码规则
export function getBusinessRule(id) {
  return request({
    url: '/identity/business-rule/get?id=' + id,
    method: 'get'
  })
}

// 获得码规则分页
export function getBusinessRulePage(query) {
  return request({
    url: '/identity/business-rule/page',
    method: 'get',
    params: query
  })
}

// 导出码规则 Excel
export function exportBusinessRuleExcel(query) {
  return request({
    url: '/identity/business-rule/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 获得码规则
export function getBusinessRuleList(params) {
  return request({
    url: '/identity/business-rule/list',
    method: 'get',
    params,
  })
}

// 获得码规则
export function listByBusinessId(params) {
  return request({
    url: '/identity/business-rule/listByBusinessId',
    method: 'get',
    params,
  })
}

// 根据identityUrl 获取首次的扫码时间与首次扫码地点
export function getFirstScanInfoByUrl(params) {
  return request({
    url: '/identity/scan-record/getFirstScanInfoByUrl',
    method: 'get',
    params,
  })
}
