//@flow

import {
  BANNER, BUTTON_GROUP, IMAGE, LIST_ITEM, MULTINPUT, PAGE_TITLE, PICKER,
  PRODUCT_BANNER, PRODUCT_TITLE, PREM_GROUP, PLAN_INFO, INSURE_YEAR, MULT, PRODUCT_IMAGE,
  SERVICE_IMAGE, NOTICE_IMAGE,
} from './keys';

export default {
  layout: {
    [PRODUCT_BANNER]: {// 组件的唯一标识，用来串联 layout, rules
      type: BANNER, // 组件类型
      uri: '', // banner需要装填数据 uri,展示的图片链接
      width: 100, //图片宽度
      height: 100, // 图片高度
    },
    [PRODUCT_TITLE]: {
      type: PAGE_TITLE,
      h1: '', // title需要装填数据 主标题
      h2: '', // title需要装填数据 副标题
      label: [], // 多个展示标签
      labelColor: '', //颜色
      mask: false,
    },
    [PREM_GROUP]: {
      type: BUTTON_GROUP,
      buttons: ['1', '2'],
      onSelect: () => {
      },
      mask: false,
      editable: true,
      selectIndex: 0,
    },
    [PLAN_INFO]: {
      type: LIST_ITEM,
      label: {
        icon: '', //左侧icon
        h1: '', //主标题
        rightIcon: '', //右侧icon
        rightText: '', //右侧文字
        onPress: () => {
        }, //点击事件

      },
      mask: false,
      editable: true,
      data: [{ key: '', value: '' }],
    },
    [INSURE_YEAR]: {
      type: PICKER,
      icon: '', //左侧icon
      text: '保障期限', //标题
      value: '', //右侧显示值
      source: {}, //修改源对象
      setKey: '', //修改源对象内的属性名称
      onSelect: () => {
      }, //点击事件
      mask: false,
      editable: true,
      selectIndex: -1,
    },
    [MULT]: {
      type: MULTINPUT,
      text: '承保份数', //标题
      value: '', //右侧显示值
      source: {}, //修改源对象
      setKey: '', //修改源对象内的属性名称
      onChangeText: () => {
      }, // 编辑文本
      onEndEditing: () => {}, //输入完毕
      mask: false,
      editable: true,
      selectIndex: 0,
    },
    [PRODUCT_IMAGE]: {
      type: IMAGE,
      uri: '',
      label: {
        icon: '', //左侧icon
        h1: '', //主标题
        rightIcon: '', //右侧icon
        rightText: '', //右侧文字
        onPress: () => {
        }, //点击事件
      },
    },
    [SERVICE_IMAGE]: {
      type: IMAGE,
      uri: '',
      label: {
        icon: '', //左侧icon
        h1: '', //主标题
        rightIcon: '', //右侧icon
        rightText: '', //右侧文字
        onPress: () => {
        }, //点击事件
      },
    },
    [NOTICE_IMAGE]: {
      type: IMAGE,
      uri: '',
      label: {
        icon: '', //左侧icon
        h1: '', //主标题
        rightIcon: '', //右侧icon
        rightText: '', //右侧文字
        onPress: () => {
        }, //点击事件
      },
    },
  },
  rules: {
    [INSURE_YEAR]: { // 串联 key 为 INSURE_YEAR的组件
      range: [], // [min , max]   [a,b,c,d] 只允许包含在 a\b\c\d内
    },
  },
  keys: [PRODUCT_BANNER, PRODUCT_TITLE, PREM_GROUP, PLAN_INFO, INSURE_YEAR, MULT, PRODUCT_IMAGE,
    SERVICE_IMAGE, NOTICE_IMAGE],
};
