// 初始化状态
const initState = {
  isHH: false,
  style: {},
  // 点赞数量
  likeNum: 0,
  // 打开分享
  shareShow: false,
  // 打开留言板
  msgShow: false,
  // 操作指引视频
  guideVideo: ''
}

// 定义 action 类型
type LayoutActionType =
  | { type: 'layout/isHH'; payload: boolean }
  | { type: 'layout/style'; payload: any }
  | { type: 'layout/likeNum'; payload: number }
  | { type: 'layout/shareShow'; payload: boolean }
  | { type: 'layout/msgShow'; payload: boolean }
  | { type: 'layout/guideVideo'; payload: string }

// 频道 reducer
export default function layoutReducer(state = initState, action: LayoutActionType) {
  switch (action.type) {
    // 是横屏还是竖屏
    case 'layout/isHH':
      return { ...state, isHH: action.payload }
    case 'layout/style':
      return { ...state, style: action.payload }
    case 'layout/likeNum':
      return { ...state, likeNum: action.payload }
    case 'layout/shareShow':
      return { ...state, shareShow: action.payload }
    case 'layout/msgShow':
      return { ...state, msgShow: action.payload }
    case 'layout/guideVideo':
      return { ...state, guideVideo: action.payload }
    default:
      return state
  }
}
