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

export interface TextCaseOptions {
  to: "UPPERCASE" | "lowercase" | "camelCase" | "snake_case" | "kebab-case";
}

export const textCasePlugin: PlimiPlugin<TextCaseOptions> = {
  manifest: {
    id: "txt-case",
    name: "Case Converter",
    description: "Convert text between camelCase, snake_case, etc.",
    category: "text",
    version: "1.0.0",
    tags: ["case", "text", "camel", "snake"],
    input: { type: "text" },
    output: { type: "text" },
    example: "hello world example text",
    offlineReady: true,
  },

  optionsSchema: {
    fields: [
      {
        type: "select",
        key: "to",
        label: "Convert to",
        defaultValue: "snake_case",
        options: [
          { label: "UPPERCASE", value: "UPPERCASE" },
          { label: "lowercase", value: "lowercase" },
          { label: "camelCase", value: "camelCase" },
          { label: "snake_case", value: "snake_case" },
          { label: "kebab-case", value: "kebab-case" },
        ],
      },
    ],
  },

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

  run: runTextCase,
};
