
import http from "@/http/http";
import { ActiveParams, Idparams, ResultInterface } from "../base/BaseDataModel";
import { ActiveBeforeCheckParam, AddEditCustomerGroup, CheckCustomerGroupParam, CopyParam, CustomerFeeQueryParam, CustomerFeeSetAdministratorDto, CustomerFeeSetAdministratorParam, CustomerFeeSetCopy, CustomerFeeSetQueryParam, CustomerFilterGroupParams, CustomerGroupDto, CustomerGroupOperateType, CustomerGroupPageParam, CustomerGroupParam, GroupQueryCustomer, ListByParentId, LoadOperatingOrganizationFeeParams, OrderFeeQueryParam, OrderFeeQueryResult, StopEndDateParams, SubmitCustomerFeeSetModel } from "./CustomerFeeSetModel";

enum Api {
    getCustomerFeeSetList = '/api/customerFeeSet/list',
    add = '/api/customerFeeSet/add',
    edit = '/api/customerFeeSet/edit',
    setFee = '/api/customerFeeSet/setFee',
    delete = '/api/customerFeeSet',
    active = '/api/customerFeeSet/active',
    customerGroupList = '/api/base/customerGroupList',
    customerGroupTreeList = '/api/customerGroup/customerGroupTreeList',
    customerGroupPageList = '/api/customerGroup/customerGroupPageList',//分页
    customerGroupAdd = '/api/customerGroup/add',
    customerGroupEdit = '/api/customerGroup/edit',
    getcustomerGroupList = '/api/customerGroup/customerGroupList',
    listByParentId = '/api/customerFeeSet/listByParentId',
    customerFeeQuery = '/api/CustomerFee/customerFeeQuery',
    getCustomerFeeSetByPId = '/api/customerFeeSet/getCustomerFeeSetByPId',
    apiOrderFeeQueryParam = '/api/apiData/apiOrderFeeQueryParam',
    downloadFeeImport = '/api/fileModel/downloadFeeImport',
    customerFeeSetCopy = '/api/customerFeeSet/copy',
    activeBeforeCheck = '/api/customerFeeSet/activeBeforeCheck',
    loadOperatingOrganizationFee = '/api/customerFeeSet/loadOperatingOrganizationFee',
    administratorList = 'api/customerFeeSetAdministrator/list',
    deleteCustomerFeeSetAdministrator = 'api/customerFeeSetAdministrator',
    addcustomerFeeSetAdministrator ='api/customerFeeSetAdministrator/add',
    getUser = '/api/user/getUser',
    editCustomerFeeSetAdministrator = 'api/customerFeeSetAdministrator/edit',
    customerFilterGroup = '/api/customerGroup/filterGroup',
    stopEndDate = '/api/customerFeeSet/stopEndDate',
    deleteCustomerGroup = '/api/customerGroup/delete',
    checkCustomerGroup = '/api/customerGroup/check',
    proportionCopy = '/api/customerFeeSet/proportionCopy',
    checkFeeSetGroup = '/api/customerGroup/checkFeeSet',
    checkCustomerGroupOperateType = '/api/customerGroup/checkCustomerGroupOperateType'
}

//查询客户费用列表
export const getCustomerFeeSetListApi = async (parms: CustomerFeeSetQueryParam) => {
    return await http.post(Api.getCustomerFeeSetList, parms)
}

// 查询当前生效记录的其他费用
export const getCustomerFeeSetParentListApi = async (parms: ListByParentId) => {
    return await http.get(Api.listByParentId, parms)
}

//新增
export const addCustomerFeeSetApi = async (parms: SubmitCustomerFeeSetModel) => {
    return await http.post(Api.add, parms)
}
//编辑
export const editCustomerFeeSetApi = async (parms: SubmitCustomerFeeSetModel) => {
    return await http.post(Api.edit, parms)
}
//设置费用
export const editCustomerFeeSetFeeApi = async (parms: SubmitCustomerFeeSetModel) => {
    return await http.post(Api.setFee, parms)
}
//删除
export const deleteCustomerFeeSetApi = async (parms: any) => {
    return await http.delete(Api.delete, parms)
}

// 是否激活
export const activeCustomerFeeSetApi = async (parms: ActiveParams) => {
    return await http.post(Api.active, parms)
}

/**
 * 查询客户分组
 * @param parms 
 * @returns 
 */
export const customerGroupListApi = async (parms: Partial<CustomerGroupParam>) => {
    return await http.post(Api.customerGroupList, parms)
}

/**
 * 查询分组树形结构数据
 * @param parms 
 * @returns 
 */
export const api_customerGroupTreeList = async (parms: Partial<CustomerGroupParam>) => {
    return await http.post(Api.customerGroupTreeList, parms)
}

/**
 * 分页查询客户分组
 * @param parms 
 * @returns 
 */
export const api_pageCustomerGroupList = async (parms: CustomerGroupPageParam) => {
    return await http.post<ResultInterface<CustomerGroupDto>>(Api.customerGroupPageList, parms)
}

// 添加客户分组
export const customerGroupAddApi = async (parms: AddEditCustomerGroup) => {
    return await http.post(Api.customerGroupAdd, parms)
}

// 编辑客户分组
export const customerGroupEditApi = async (parms: AddEditCustomerGroup) => {
    return await http.post(Api.customerGroupEdit, parms)
}

/**
 * 检查分组
 * @param parms 
 * @returns 
 */
export const api_checkCustomerGroup = async (parms: CheckCustomerGroupParam) => {
    return await http.post(Api.checkCustomerGroup, parms)
}

/**
 * 删除分组
 * @param parms 
 * @returns 
 */
export const api_deleteCustomerGroup = async (parms: Idparams) => {
    return await http.post(Api.deleteCustomerGroup, parms)
}

/**
 * 校验分组信息
 * @param parms 
 * @returns 
 */
export const api_checkFeeSetGroup = async (parms: AddEditCustomerGroup) => {
    return await http.post(Api.checkFeeSetGroup, parms)
}

/**
 * 判断分组客户操作类型
 * @param parms 
 * @returns 
 *  Add(0, "新增客户"),
 *  Delete (1, "删除客户"),
 *  Modify(2,"调整客户");
 */
export const api_checkCustomerGroupOperateType = async (parms: CustomerGroupOperateType) => {
    return await http.post(Api.checkCustomerGroupOperateType, parms)
}

/**
 * 查看分组所属客户
 * @param parms 
 * @returns
 */
export const getcustomerGroupListApi = async (parms: GroupQueryCustomer) => {
    return await http.post(Api.getcustomerGroupList, parms)
}

// 查看过滤客户
export const customerFilterGroup = async (parms: CustomerFilterGroupParams) => {
    return await http.post(Api.customerFilterGroup, parms)
}

// 查看客户费用设置查询
export const getCustomerFeeQueryApi = async (parms: CustomerFeeQueryParam) => {
    return await http.post(Api.customerFeeQuery, parms)
}

// 根据ID查找费用
export const api_GetCustomerFeeSetByPId = async (parms: GroupQueryCustomer) => {
    return await http.post(Api.getCustomerFeeSetByPId, parms)
}

/**
 * 计费参数获取(根据订单号)
 */
export const api_OrderFeeQueryParam = async (parms: OrderFeeQueryParam) => {
    return await http.post<OrderFeeQueryResult>(Api.apiOrderFeeQueryParam, parms)
}

/**
 * 分区费用模版导出
 */
export const api_DownloadFeeImport = async (parms?: Recordable) => {
    return await http.download(Api.downloadFeeImport, parms)
}

/**
 * 客户费用拷贝
 */
export const api_customerFeeSetCopy = async (parms: CustomerFeeSetCopy) => {
    return await http.post(Api.customerFeeSetCopy, parms)
}

/**
 * 客户费用拷贝
 */
export const api_customerFeeSetProportionCopy = async (parms: CopyParam) => {
    return await http.post(Api.proportionCopy, parms)
}


/**
 * 检测费用设置是否激活提示
 */
export const api_customerFeeActiveBeforeCheck = async (parms: ActiveBeforeCheckParam) => {
    return await http.post(Api.activeBeforeCheck, parms)
}

/**
 * 客户费用接管列表
 * @param parms 
 * @returns 
 */
export const api_customerFeeSetAdministratorList = async (parms: CustomerFeeSetAdministratorParam) => {
    return await http.post<ResultInterface<CustomerFeeSetAdministratorDto>>(Api.administratorList, parms)
}
/**
 * 客户费用接管删除
 * @param parms 
 * @returns 
 */
export const api_deleteCustomerFeeSetAdministrator = async (parms: Idparams) => {
    return await http.delete(Api.deleteCustomerFeeSetAdministrator, parms)
}
/**
 * 客户费用接管添加
 */
export const api_addcustomerFeeSetAdministrator = async (parms: Partial<CustomerFeeSetAdministratorDto>) => {
    return await http.post(Api.addcustomerFeeSetAdministrator, parms)
}
/**
 * 根据用户编号获取用户信息
 * @param parms 
 * @returns 
 */
export const api_getUser = async (parms: Idparams) => {
    return await http.get(Api.getUser, parms)
}
/**
 * 通知人员编辑接口
 * @param parms 
 * @returns 
 */
export const api_editCustomerFeeSetAdministrator = async (parms: Partial<CustomerFeeSetAdministratorDto>) => {
    return await http.post(Api.editCustomerFeeSetAdministrator, parms)
}
/**
 * 加载结算价
 * @param parms 
 * @returns 
 */
export const api_customerFeeSetLoadOperatingOrganizationFee = async (parms: LoadOperatingOrganizationFeeParams) => {
    return await http.post(Api.loadOperatingOrganizationFee, parms)
}

/**
 * 终止结束时间
 */
export const api_CustomerFeeStopEndDate = async (parms: StopEndDateParams) => {
    return await http.post(Api.stopEndDate, parms)
}