import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PtOperatorVO, PtOperatorForm, PtOperatorQuery } from '@/api/basics/merchant/ptOperator/types';

/**
 * 查询营业员列表
 * @param query
 * @returns {*}
 */

export const listPtOperator = (query?: PtOperatorQuery): AxiosPromise<PtOperatorVO[]> => {
  return request({
    url: '/backstage/merchant/ptOperator/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询营业员详细
 * @param operatorId
 */
export const getPtOperator = (operatorId: string | number): AxiosPromise<PtOperatorVO> => {
  return request({
    url: '/backstage/merchant/ptOperator/' + operatorId,
    method: 'get'
  });
};

/**
 * 新增营业员
 * @param data
 */
export const addPtOperator = (data: PtOperatorForm) => {
  return request({
    url: '/backstage/merchant/ptOperator',
    method: 'post',
    data: data
  });
};

/**
 * 修改营业员
 * @param data
 */
export const updatePtOperator = (data: PtOperatorForm) => {
  return request({
    url: '/backstage/merchant/ptOperator',
    method: 'put',
    data: data
  });
};

/**
 * 删除营业员
 * @param operatorId
 */
export const delPtOperator = (operatorId: string | number | Array<string | number>) => {
  return request({
    url: '/backstage/merchant/ptOperator/' + operatorId,
    method: 'delete'
  });
};
