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

const formHeaders = { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }

// ========== 邮件主控服务 ==========

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

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

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

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

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

// ========== 邮件额度商品 ==========

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

export const createMailGoods = (data) => {
  return http2.post('/api/v1/admin/server/mail_service/goods/create', data, formHeaders)
}

export const updateMailGoods = (data) => {
  return http2.post('/api/v1/admin/server/mail_service/goods/update', data, formHeaders)
}

export const deleteMailGoods = (data) => {
  return http2.delete('/api/v1/admin/server/mail_service/goods/delete', { data, ...formHeaders })
}
