import React from 'react';
import PageFlow from './page-flow';
import PageList from './page-list';
import PageForm from './page-form';
import PageEmpty from './page-empty';
import connect from "../connect";

/**
 * 属性类型
 */
 export interface Props {
    type:
      |'empty' // 空白页
      | 'list' // 列表页
      | 'flow' // 信息流页
      | 'form'; // 表单页
  }

  /**
   * 页面
   */
  const Page: React.FC<Props> = ({ type, ...otherProps }) => {
    if (type === 'empty') return <PageEmpty {...otherProps} />;
    if (type === 'list') return <PageList {...otherProps} />;
    if (type === 'flow') return <PageFlow {...otherProps} />;
    if (type === 'form') return <PageForm {...otherProps} />;
    return null;
  };

  export default connect(Page, {}, {
    'empty': (PageEmpty as any).default,
    'list': (PageList as any).default,
    'flow': (PageFlow as any).default,
    'form': (PageForm as any).default,
  });
