// 初始化状态应用注解
const initState = {
  // 表格数据
  info4: {
    list: [] as any,
    total: 0,
  },
  // 表格顶部数字数据
  infoNum4: [],
  // 查看和审核的表格信息
  lookInfo: {
    info: {} as any,
    list: [] as any,
  },
  // 新增或者编辑的藏品信息列表
  goodsTableList: [] as any,
  // 点击新增或者编辑里面的添加按钮的所有藏品列表
  goodsAllList: [] as any,
  // 新增和编辑页面出库类型下拉框
  typeSelectList: [
    { id: 1, label: "展览", value: "展览" },
    { id: 2, label: "研究", value: "研究" },
    { id: 3, label: "修复", value: "修复" },
    { id: 4, label: "复制", value: "复制" },
    { id: 5, label: "文创", value: "文创" },
    { id: 6, label: "其他", value: "其他" },
  ],
};

type LoginActionType =
  | { type: "object4/getList"; payload: any }
  | { type: "object4/getListNum"; payload: any }
  | { type: "object4/getLookInfo"; payload: any }
  | { type: "object4/getGoodsTableList"; payload: any }
  | { type: "object4/setGoodsListAll"; payload: any };
// 频道 reducer
export default function object4Reducer(
  state = initState,
  action: LoginActionType
) {
  switch (action.type) {
    // 表格数据1
    case "object4/getList":
      return { ...state, info4: action.payload };
    // 表格顶部数字数据1
    case "object4/getListNum":
      return { ...state, infoNum4: action.payload };
    // 查看和审核的表格数据
    case "object4/getLookInfo":
      return { ...state, lookInfo: action.payload };
    // 新增或者编辑的藏品信息列表
    case "object4/getGoodsTableList":
      return { ...state, goodsTableList: action.payload };
    // 点击新增或者编辑里面的添加按钮的所有藏品列表
    case "object4/setGoodsListAll":
      return { ...state, goodsAllList: action.payload };

    default:
      return state;
  }
}
