import { ComponentMetadata, Snippet } from '@alilc/lowcode-types';

const SortableWalletPassTypesMeta: ComponentMetadata = {
  "componentName": "SortableWalletPassTypes",
  "title": "可排序钱包通行证类型",
  "docUrl": "",
  "screenshot": "",
  "devMode": "proCode",
  "npm": {
    "package": "@pisell/private-materials",
    "version": "1.1.558",
    "exportName": "SortableWalletPassTypes",
    "main": "src/index.ts",
    "destructuring": true,
    "subName": ""
  },
  "configure": {
    "props": [
      {
        "title": {
          "label": {
            "type": "i18n",
            "en-US": "value",
            "zh-CN": "当前值"
          },
          "tip": {
            "type": "i18n",
            "en-US": "Current value of wallet pass types configuration",
            "zh-CN": "钱包通行证类型的当前配置值"
          }
        },
        "name": "value",
        "propType": {
          "type": "arrayOf",
          "value": {
            "type": "shape",
            "value": [
              {
                "name": "type",
                "propType": {
                  "type": "oneOf",
                  "value": ["balance", "point", "voucher", "discount"]
                },
                "description": "钱包通行证类型"
              },
              {
                "name": "display",
                "propType": {
                  "type": "oneOf", 
                  "value": [0, 1]
                },
                "description": "是否显示，1表示显示，0表示隐藏"
              },
              {
                "name": "custom_title",
                "propType": {
                  "type": "shape",
                  "value": [
                    {
                      "name": "original",
                      "propType": "string"
                    },
                    {
                      "name": "en", 
                      "propType": "string"
                    },
                    {
                      "name": "zh-CN",
                      "propType": "string"
                    },
                    {
                      "name": "zh-HK",
                      "propType": "string"
                    }
                  ]
                },
                "description": "自定义标题，支持多语言"
              }
            ]
          }
        },
        "setter": ["JsonSetter", "VariableSetter"],
        "defaultValue": [
          {
            "type": "balance",
            "display": 1,
            "custom_title": {
              "original": "Balance",
              "en": "Balance",
              "zh-CN": "余额",
              "zh-HK": "餘額"
            }
          },
          {
            "type": "point",
            "display": 1,
            "custom_title": {
              "original": "Points", 
              "en": "Points",
              "zh-CN": "积分",
              "zh-HK": "積分"
            }
          },
          {
            "type": "voucher",
            "display": 1,
            "custom_title": {
              "original": "Voucher",
              "en": "Voucher", 
              "zh-CN": "代金券",
              "zh-HK": "代金券"
            }
          },
          {
            "type": "discount",
            "display": 1,
            "custom_title": {
              "original": "Discount",
              "en": "Discount",
              "zh-CN": "折扣券", 
              "zh-HK": "折扣券"
            }
          }
        ]
      },
      {
        "title": {
          "label": {
            "type": "i18n",
            "en-US": "onChange",
            "zh-CN": "变更回调"
          },
          "tip": {
            "type": "i18n",
            "en-US": "Callback function when value changes",
            "zh-CN": "值变化时的回调函数"
          }
        },
        "name": "onChange",
        "propType": "func",
        "setter": [
          {
            "componentName": "FunctionSetter",
            "props": {
              "template": "onChange(value,${extParams}){\n// 钱包通行证类型配置变化回调\nconsole.log('value changed:', value);\n}"
            }
          },
          "VariableSetter"
        ]
      },
      {
        "title": {
          "label": {
            "type": "i18n",
            "en-US": "disabled",
            "zh-CN": "禁用"
          },
          "tip": {
            "type": "i18n", 
            "en-US": "Whether to disable the component",
            "zh-CN": "是否禁用组件"
          }
        },
        "name": "disabled",
        "propType": "bool",
        "setter": ["BoolSetter", "VariableSetter"],
        "defaultValue": false
      },
      {
        "title": {
          "label": {
            "type": "i18n",
            "en-US": "className",
            "zh-CN": "CSS类名"
          }
        },
        "name": "className",
        "propType": "string",
        "setter": ["StringSetter", "VariableSetter"]
      },
      {
        "title": {
          "label": {
            "type": "i18n",
            "en-US": "style",
            "zh-CN": "内联样式"
          }
        },
        "name": "style",
        "propType": "object",
        "setter": ["JsonSetter", "VariableSetter"]
      }
    ],
    "supports": {
      "className": true,
      "style": true,
      "events": [
        {
          "name": "onChange",
          "template": "onChange(value,${extParams}){\n// 钱包通行证类型配置变化回调\nconsole.log('value changed:', value);\n}"
        }
      ]
    },
    "component": {
      "isContainer": false
    }
  }
};

const snippets: Snippet[] = [
  {
    "title": "可排序钱包通行证类型",
    "screenshot": "",
    "schema": {
      "componentName": "SortableWalletPassTypes",
      "props": {
        "value": [
          {
            "type": "balance",
            "display": 1,
            "custom_title": {
              "original": "Balance",
              "en": "Balance", 
              "zh-CN": "余额",
              "zh-HK": "餘額"
            }
          },
          {
            "type": "point",
            "display": 1,
            "custom_title": {
              "original": "Points",
              "en": "Points",
              "zh-CN": "积分", 
              "zh-HK": "積分"
            }
          },
          {
            "type": "voucher",
            "display": 0,
            "custom_title": {
              "original": "Voucher",
              "en": "Voucher",
              "zh-CN": "代金券",
              "zh-HK": "代金券"
            }
          },
          {
            "type": "discount",
            "display": 0,
            "custom_title": {
              "original": "Discount",
              "en": "Discount",
              "zh-CN": "折扣券",
              "zh-HK": "折扣券"
            }
          }
        ]
      }
    }
  }
];

export default {
  ...SortableWalletPassTypesMeta,
  snippets
};
