import {
  common_service_t_customer_info_post,
  common_service_t_customer_info_patch,
  common_service_t_customer_info_id_get,
  common_service_t_customer_info_id_delete,
} from '@/sdk/api/common';

import { autoCreateEffects } from '@/utils/handleModels';
export default {
  namespace: 'customer',
  state: {
    customerList: [],
    customerDetail:{},
  },
  effects: {
    ...autoCreateEffects([
      {
        type: 'common_service_t_customer_info_post',
        api: common_service_t_customer_info_post,
        handle: 'content',
        key: 'customerList',
      }, // 客户列表
      {
        type: 'common_service_t_customer_info_id_get',
        api: common_service_t_customer_info_id_get,
        key:'customerDetail'
      },
       {
        type: 'common_service_t_customer_info_patch',
        api: common_service_t_customer_info_patch,
      },
      {
        type: 'common_service_t_customer_info_id_delete',
        api: common_service_t_customer_info_id_delete,
      }, //客户删除
    ]),
  },

  reducers: {
    setModelsState(state, action) {
      return {
        ...state,
        ...action.payload,
      };
    },
  },
};