import { http2 } from '@/utils/request.js'

const formHeaders = { headers: { 'Content-Type': 'multipart/form-data' } }

// ========== 短信主控服务 ==========

export const getSmsServiceList = (params) => {
  return http2.get('/api/v1/admin/server/sms_service/list', { params })
}

export const createSmsService = (data) => {
  return http2.post('/api/v1/admin/server/sms_service/create', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })
}

export const updateSmsService = (data) => {
  return http2.post('/api/v1/admin/server/sms_service/update', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })
}

export const deleteSmsService = (data) => {
  return http2.delete('/api/v1/admin/server/sms_service/delete', {
    data,
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })
}

export const setDefaultSmsService = (data) => {
  return http2.post('/api/v1/admin/server/sms_service/set_default', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })
}

// ========== 短信额度商品 ==========

export const getSmsGoodsList = (params) => {
  return http2.get('/api/v1/admin/server/sms_service/goods/list', { params })
}

export const createSmsGoods = (data) => {
  return http2.post('/api/v1/admin/server/sms_service/goods/create', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })
}

export const updateSmsGoods = (data) => {
  return http2.post('/api/v1/admin/server/sms_service/goods/update', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })
}

export const deleteSmsGoods = (data) => {
  return http2.delete('/api/v1/admin/server/sms_service/goods/delete', {
    data,
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })
}

// ========== 短信签名管理 ==========

export const getSmsSignatureList = (params) => {
  return http2.get('/api/v1/admin/server/sms_service/signature/list', { params })
}

export const getSmsSignatureDetail = (params) => {
  return http2.get('/api/v1/admin/server/sms_service/signature/detail', { params })
}

export const createSmsSignature = (data) => {
  return http2.post('/api/v1/admin/server/sms_service/signature/create', data, formHeaders)
}

export const updateSmsSignature = (data) => {
  return http2.post('/api/v1/admin/server/sms_service/signature/update', data, formHeaders)
}

export const deleteSmsSignature = (data) => {
  return http2.delete('/api/v1/admin/server/sms_service/signature/delete', { data, ...formHeaders })
}

export const submitSmsSignature = (data) => {
  return http2.post('/api/v1/admin/server/sms_service/signature/submit', data, formHeaders)
}

export const approveSmsSignature = (data) => {
  return http2.post('/api/v1/admin/server/sms_service/signature/approve', data, formHeaders)
}

export const rejectSmsSignature = (data) => {
  return http2.post('/api/v1/admin/server/sms_service/signature/reject', data, formHeaders)
}

// ========== 短信模板管理 ==========

export const getSmsTemplateList = (params) => {
  return http2.get('/api/v1/admin/server/sms_service/template/list', { params })
}

export const getSmsTemplateDetail = (params) => {
  return http2.get('/api/v1/admin/server/sms_service/template/detail', { params })
}

export const createSmsTemplate = (data) => {
  return http2.post('/api/v1/admin/server/sms_service/template/create', data, formHeaders)
}

export const updateSmsTemplate = (data) => {
  return http2.post('/api/v1/admin/server/sms_service/template/update', data, formHeaders)
}

export const deleteSmsTemplate = (data) => {
  return http2.delete('/api/v1/admin/server/sms_service/template/delete', { data, ...formHeaders })
}

export const submitSmsTemplate = (data) => {
  return http2.post('/api/v1/admin/server/sms_service/template/submit', data, formHeaders)
}

export const approveSmsTemplate = (data) => {
  return http2.post('/api/v1/admin/server/sms_service/template/approve', data, formHeaders)
}

export const rejectSmsTemplate = (data) => {
  return http2.post('/api/v1/admin/server/sms_service/template/reject', data, formHeaders)
}

// ========== 推荐模板管理 ==========

export const getSmsRecommendedTemplateList = (params) => {
  return http2.get('/api/v1/admin/server/sms_service/template/recommended/list', { params })
}

export const createSmsRecommendedTemplate = (data) => {
  return http2.post('/api/v1/admin/server/sms_service/template/recommended/create', data, formHeaders)
}

export const updateSmsRecommendedTemplate = (data) => {
  return http2.post('/api/v1/admin/server/sms_service/template/recommended/update', data, formHeaders)
}

export const deleteSmsRecommendedTemplate = (data) => {
  return http2.delete('/api/v1/admin/server/sms_service/template/recommended/delete', { data, ...formHeaders })
}
