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

export const jwtDecoderPlugin: PlimiPlugin = {
  manifest: {
    id: "jwt-decoder",
    name: "JWT Decoder",
    description: "Decode and inspect JSON Web Tokens (JWT) locally in your browser.",
    category: "developer",
    version: "1.0.0",
    tags: ["jwt", "token", "decoder", "auth", "json"],
    input: {
      type: "text",
      label: "JWT Token",
      placeholder: "Paste your JWT token here (encoded header.payload.signature)...",
      multiline: true,
      rows: 6,
    },
    output: { type: "json" },
    example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjE4MTYyMzkwMjJ9.signature-placeholder",
    offlineReady: true,
  },

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

  run: runJwtDecoder,
};
