import request from '@/utils/http'

/**
 * 查询当前服务商分时段电话列表和审批状态
 * @param {Object} params
 * @param {number} params.supplierId 服务商 ID
 */
export function getSupplierPhoneList(params) {
  return request({
    url: '/supplierAppV2/dispatchApp/supplierPhone/list',
    method: 'GET',
    params
  })
}

/**
 * 查询当前服务商电话时段变更审批状态
 * @param {Object} params
 * @param {number} params.supplierId 服务商 ID
 */
export function getSupplierPhoneApprovalStatus(params) {
  return request({
    url: '/supplierAppV2/dispatchApp/supplierPhone/approvalStatus',
    method: 'GET',
    params
  })
}

/**
 * 提交服务商电话时段变更审批
 * @param {Object} data
 * @param {number} data.supplierId 服务商 ID
 * @param {string} [data.modifyReason] 修改原因
 * @param {Array} data.phoneList 电话时段草稿列表
 */
export function submitSupplierPhoneApproval(data) {
  return request({
    url: '/supplierAppV2/dispatchApp/supplierPhone/submit',
    method: 'POST',
    contentType: 'application/json',
    data
  })
}
