export type C4tableType = {
  createTime: string
  creatorId: number
  creatorName: string
  fileName: string
  filePath: string
  fileSize: string
  id: number
  joinName: string
  joinNum: string
  moduleId: number
  moduleName: string
  parentId: number
  thumb: string
  type: string
  updateTime: string
}

// 初始化状态
const initState = {
  // 列表数据
  tableInfo: {
    list: [] as C4tableType[],
    total: 0
  }
}

// 定义 action 类型
type Props = {
  type: 'C4/getList'
  payload: { list: C4tableType[]; total: number }
}

// reducer
export default function Reducer(state = initState, action: Props) {
  switch (action.type) {
    // 获取列表数据
    case 'C4/getList':
      return { ...state, tableInfo: action.payload }

    default:
      return state
  }
}
