import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ManualChannelConfigVO, ManualChannelConfigForm, ManualChannelConfigQuery } from '@/api/msg/manualChannelConfig/types';
import { data } from 'autoprefixer';

/**
 * 查询手工短信发送通道配置列表
 * @param query
 * @returns {*}
 */

export const listManualChannelConfig = (query?: ManualChannelConfigQuery): AxiosPromise<ManualChannelConfigVO[]> => {
  return request({
    url: '/msg/manualChannelConfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询所有手工短信发送通道配置列表
 * @param query
 * @returns {*}
 */

export const getAllSmsManualChannelConfig = (query?: ManualChannelConfigQuery): AxiosPromise<ManualChannelConfigVO[]> => {
  return request({
    url: '/msg/manualChannelConfig/getAllSmsManualChannelConfig',
    method: 'get',
    params: query
  });
};



/**
 * 查询手工短信发送通道审核列表
 * @param query
 * @returns {*}
 */

export const queryReviewSendChannel = () => {
  return request({
    url: '/msg/manualInfo/queryReviewSendChannel',
    method: 'get'
  });
};

/**
 * 查询手工短信发送通道配置详细
 * @param id
 */
export const getManualChannelConfig = (id: string | number): AxiosPromise<ManualChannelConfigVO> => {
  return request({
    url: '/msg/manualChannelConfig/' + id,
    method: 'get'
  });
};

/**
 * 新增手工短信发送通道配置
 * @param data
 */
export const addManualChannelConfig = (data: ManualChannelConfigForm) => {
  return request({
    url: '/msg/manualChannelConfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改手工短信发送通道配置
 * @param data
 */
export const updateManualChannelConfig = (data: ManualChannelConfigForm) => {
  return request({
    url: '/msg/manualChannelConfig',
    method: 'put',
    data: data
  });
};

/**
 * 删除手工短信发送通道配置
 * @param id
 */
export const delManualChannelConfig = (id: string | number | Array<string | number>) => {
  return request({
    url: '/msg/manualChannelConfig/' + id,
    method: 'delete'
  });
};

/**
 * 审核通过
 */
export const saveSendChannel = (row) => {
  return request({
    url: '/msg/manualInfo/saveSendChannel',
    method: 'post',
    data: row
  });
};

/**
 * 审核不通过
 */
export const removeSendChannelApply = (row) => {
  return request({
    url: '/msg/manualInfo/removeSendChannelApply',
    method: 'post',
    data: row
  });
};
/**
 * 申请
 * @param providerId
 * @param updateChannel
 */
export const sendChannelApply = (providerId, updateChannel) => {
  const data = {
    providerId,
    updateChannel
  };
  return request({
    url: '/msg/manualInfo/sendChannelApply',
    method: 'post',
    data: data
  });
};

