import type { PlimiPlugin } from "../../core/plugins/plugin-types";
import { runLoremIpsum } from "./run";

export interface LoremIpsumOptions {
  type: "paragraphs" | "sentences" | "words";
  count: number;
}

export const loremIpsumPlugin: PlimiPlugin<LoremIpsumOptions> = {
  manifest: {
    id: "txt-lorem",
    name: "Lorem Ipsum Generator",
    description: "Generate placeholder text in paragraphs, sentences, or words.",
    category: "text",
    version: "1.0.0",
    tags: ["lorem", "ipsum", "placeholder", "text"],
    input: { type: "none" },
    output: { type: "text" },
    example: "Click 'Try example' to generate placeholder text.",
    offlineReady: true,
  },

  optionsSchema: {
    fields: [
      {
        type: "select",
        key: "type",
        label: "Unit",
        defaultValue: "paragraphs",
        options: [
          { label: "Paragraphs", value: "paragraphs" },
          { label: "Sentences", value: "sentences" },
          { label: "Words", value: "words" },
        ],
      },
      {
        type: "slider",
        key: "count",
        label: "Count",
        defaultValue: 3,
        min: 1,
        max: 50,
        step: 1,
      },
    ],
  },

  capabilities: {
    cancelable: false,
    worker: false,
  },

  run: runLoremIpsum,
};
