import { Schema } from "effect";
import { Locale } from "../../../../../share/locale.js";
import { Expression } from "../../../../../share/expression.js";
export const type = "com.shwfed.block.markdown";
export const compatibilityDate = "2026-05-06";
export const metadata = {
  name: "Markdown",
  icon: "fluent:markdown-20-regular",
  w: { initial: 8, min: 2, max: Infinity },
  h: { initial: 2, min: 2, max: Infinity }
};
export function schema(configure, _blockRef) {
  const CelStyle = Expression({
    configure,
    resultType: (t) => t === "string" || t === "dyn" || t.startsWith("map") || t.startsWith("optional")
  });
  return Schema.Struct({
    id: Schema.UUID.annotations({ description: "\u5757\u552F\u4E00\u6807\u8BC6" }),
    type: Schema.tag(type),
    compatibilityDate: Schema.tag(compatibilityDate),
    displayName: Schema.optional(Schema.String.annotations({
      title: "\u5185\u90E8\u540D\u79F0",
      description: "\u4EC5\u5728\u7F16\u8F91\u5668\u5185\u53EF\u89C1\u7684\u5757\u540D\uFF0C\u7528\u4E8E\u5728\u4FA7\u8FB9\u680F\u548C\u5E03\u5C40\u7F16\u8F91\u5668\u4E2D\u8BC6\u522B\u5757\uFF1B\u8FD0\u884C\u65F6\u4E0D\u5C55\u793A"
    })),
    style: Schema.optional(CelStyle).annotations({
      title: "\u6837\u5F0F",
      description: "\u8FD4\u56DE\u5E94\u7528\u5728 Markdown \u5757\u6839\u5143\u7D20\u4E0A\u7684\u6837\u5F0F\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u53EF\u8FD4\u56DE CSS \u5B57\u7B26\u4E32\uFF08\u5982 `'padding: 2rem'`\uFF09\u6216\u6837\u5F0F\u5BF9\u8C61\uFF08\u5982 `{'padding': '2rem'}`\uFF09\uFF1B\u7559\u7A7A\u5219\u4E0D\u8BBE\u989D\u5916\u6837\u5F0F"
    }),
    content: Locale.annotations({
      title: "\u5185\u5BB9",
      description: "\u6E32\u67D3\u4E3A Markdown \u7684\u591A\u8BED\u8A00\u6587\u672C"
    })
  }).annotations({
    title: "Markdown \u5757",
    description: "\u6E32\u67D3\u4E00\u6BB5 Markdown \u6587\u672C\u4F5C\u4E3A\u9875\u9762\u5757"
  });
}
export function defaultBody() {
  return { content: [{ locale: "zh", message: "" }] };
}
