import { getFlowEventConfig } from "../_com-props/flowEventConfig";
import { t } from "../../src/locale";
import { CGroupManagerSetter, CSelectSetter, CStringOnlySetter } from "../_setters";
import { PageDisplayEnum, PageLoadingMode } from "../_utils/formKeyType";
import { WalletEnvType } from "../_setters/cBehavior-setter/type";
export default {
  componentName: "Page",
  props: [{
    title: t("page.base"),
    display: "accordion",
    type: "group",
    items: [{
      name: 'webGid',
      title: {
        label: t('loop-box.key_m1Tbsriyh12Z'),
        tip: t('loop-box.key_1srzDzyjKm9i')
      },
      isRequired: true,
      propType: 'string',
      setter: CStringOnlySetter,
      supportVariable: false
    }, {
      name: "initEnvType",
      title: {
        label: t("page.initEnvTypeLabel"),
        tip: t("page.initEnvTypeTip")
      },
      setter: {
        componentName: CSelectSetter,
        props: {
          options: [{
            label: t('setter.walletEmailEnvType'),
            value: WalletEnvType.noWallet
          }, {
            label: t('setter.walletWEnvType'),
            value: WalletEnvType.wallet
          }]
        }
      }
    }, {
      name: "isWalletConnect",
      title: {
        label: t("gridCol.key_CmdPFwsmmH3M"),
        tip: t("gridCol.key_CmdPFwsmmH4M")
      },
      propType: "bool",
      setter: "BoolSetter",
      defaultValue: false
    }, {
      name: 'styleWebOS',
      title: {
        label: t('gridRow.key_FAr6jUiyP7z4'),
        tip: t('gridRow.key_tcUnf2iinPgb')
      },
      propType: 'bool',
      setter: "BoolSetter",
      defaultValue: false
    }, {
      name: "pageDisplay",
      display: "accordion",
      title: {
        label: t("page.pageDisplay"),
        tip: t("page.pageDisplayTip")
      },
      setter: {
        componentName: "ObjectSetter",
        props: {
          config: {
            items: [{
              name: "display",
              title: {
                label: t("page.display"),
                tip: t("page.displayTip")
              },
              propType: {
                type: "oneOf",
                value: [PageDisplayEnum.Normal, PageDisplayEnum.ByRatio]
              },
              setter: [{
                componentName: "RadioGroupSetter",
                props: {
                  options: [{
                    title: t("page.ByRatio"),
                    value: PageDisplayEnum.ByRatio
                  }, {
                    title: t("page.Normal"),
                    value: PageDisplayEnum.Normal
                  }]
                }
              }, "VariableSetter"],
              defaultValue: PageDisplayEnum.Normal
            }, {
              name: "width",
              title: {
                label: t("page.width") + " (px)",
                tip: t("page.widthTip")
              },
              setter: {
                componentName: "NumberSetter",
                props: {
                  step: 1,
                  min: 0
                }
              },
              defaultValue: 1440,
              condition: function condition(target) {
                var type = target.parent.getPropValue("display");
                return type === PageDisplayEnum.ByRatio;
              }
            }, {
              name: "height",
              title: {
                label: t("page.height") + " (px)",
                tip: t("page.heightTip")
              },
              setter: {
                componentName: "NumberSetter",
                props: {
                  step: 1,
                  min: 0
                }
              },
              defaultValue: 698,
              condition: function condition(target) {
                var type = target.parent.getPropValue("display");
                return type === PageDisplayEnum.ByRatio;
              }
            }]
          }
        }
      }
    }, {
      name: "loadingMode",
      title: {
        label: t("page.loadingMode"),
        tip: t("page.loadingMode")
      },
      setter: {
        componentName: "RadioGroupSetter",
        props: {
          options: [{
            title: t("page.loadLevelByLevel"),
            value: PageLoadingMode.LevelByLevel
          }, {
            title: t("page.preloadAll"),
            value: PageLoadingMode.All
          }, {
            title: t("page.preloadFirstLevel"),
            value: PageLoadingMode.Level1
          }]
        },
        initialValue: PageLoadingMode.LevelByLevel
      }
    }, getFlowEventConfig(), getFlowEventConfig({
      name: "watchParentParamsChangeFV",
      label: t('page.watchParentParamsChangeFV'),
      tip: t('page.watchParentParamsChangeFVTip'),
      props: {}
    }), getFlowEventConfig({
      name: "visibilityChangeVisible",
      label: t('page.visibilityChangeVisible'),
      tip: t('page.visibilityChangeVisibleTip'),
      props: {}
    }), getFlowEventConfig({
      name: "visibilityChangeHidden",
      label: t('page.visibilityChangeHidden'),
      tip: t('page.visibilityChangeHiddenTip'),
      props: {}
    })]
  }, {
    title: t("page.tgConfig"),
    display: "accordion",
    type: "group",
    items: [{
      name: "headerBackgroundColor",
      title: {
        label: t("page.headerBackgroundColor"),
        tip: t("page.headerBackgroundColor")
      },
      setter: 'ColorSetter'
    }, {
      name: "bodyBackgroundColor",
      title: {
        label: t("page.bodyBackgroundColor"),
        tip: t("page.bodyBackgroundColor")
      },
      setter: 'ColorSetter'
    }]
  }, {
    title: t("page.advanced"),
    display: "accordion",
    type: "group",
    items: [{
      name: "groupManager",
      title: {
        label: t("page.groupManager"),
        tip: t("page.groupManagerTip")
      },
      setter: CGroupManagerSetter
    }]
  }],
  configure: {
    supports: {
      events: false,
      style: true,
      loop: false,
      condition: false
    }
  }
};