import React from "react";
import { EventName, createComponent } from "@lit/react";
import { WeavyComponents } from "@weavy/uikit-web";
import type { FileOpenEventType } from "@weavy/uikit-web/dist/types/types/files.events.d.ts";

// Creates a React component from a Lit component
export const WyAttachment = createComponent({
  react: React,
  tagName: "wy-attachment",
  elementClass: WeavyComponents.WyAttachment,
  events: {
    onFileOpen: "file-open" satisfies FileOpenEventType["type"] as EventName<FileOpenEventType>,
  },
});

export const WyAttachmentList = createComponent({
  react: React,
  tagName: "wy-attachment-list",
  elementClass: WeavyComponents.WyAttachmentList,
  events: {
    onFileOpen: "file-open" satisfies FileOpenEventType["type"] as EventName<FileOpenEventType>,
  },
});
