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

const DivMeta: ComponentMetadata = {
  componentName: "OrganizationTenantSwitcher",
  title: "企业租户切换",
  docUrl: "",
  screenshot: "",
  devMode: "proCode",
  npm: {
    package: "@pisell/materials",
    version: "1.0.3",
    exportName: "OrganizationTenantSwitcher",
    main: "src/index.tsx",
    destructuring: true,
    subName: "",
  },
  props: [
    {
      name: "showLogo",
      title: "显示商标",
      setter: "BoolSetter",
      defaultValue: true,
      supportVariable: true
    },
    {
      name: "showName",
      title: "显示企业名称",
      setter: "BoolSetter", 
      defaultValue: true,
      supportVariable: true
    },
    {
      name: "readOnly",
      title: "是否只读",
      setter: "BoolSetter",
      defaultValue: false,
      supportVariable: true
    },
    /*
    {
      name: "options",
      title: "企业列表",
      setter: {
        componentName: "ArraySetter",
        props: {
          itemSetter: {
            componentName: "ObjectSetter",
            props: {
              config: {
                items: [
                  {
                    name: "label",
                    title: "企业名称",
                    propType: "string",
                    setter: "StringSetter",
                    isRequired: true,
                  },
                  {
                    name: "value",
                    title: "企业ID",
                    propType: "string",
                    setter: "StringSetter",
                    isRequired: true,
                  },
                  {
                    name: "logo",
                    title: "企业Logo",
                    propType: "string",
                    setter: "StringSetter",
                  },
                ]
              }
            }
          }
        }
      },
      defaultValue: [],
      supportVariable: true
    }
    */
  ],
  configure: {
    supports: {
      style: true,
      events: [
        {
          name: "onClick",
          template:
            "onClick(event,${extParams}){\n// 点击时的回调\nconsole.log('onClick', event);}",
        },
      ],
    },
    component: {
      isContainer: true,
    },
  },
};
const snippets: Snippet[] = [
  {
    title: "企业租户切换",
    screenshot: "",
    schema: {
      title: "企业租户切换",
      componentName: "OrganizationTenantSwitcher",
      props: {
        showLogo: true,
        showName: true,
        options: [
          {
            label: "企业1",
            value: "1",
            logo: 'https://pisell2-dev.s3.cn-north-1.amazonaws.com.cn/media/tenant-0/2025/01/10/01jh7vas0ga68jgajsarv9g46c.png'
          },
          {
            label: "企业2",
            value: "2",
          }
        ]
      },
    },
  },
];

export default {
  ...DivMeta,
  snippets,
};
