{
  "openapi": "3.0.3",
  "info": {
    "title": "字帖库 AI 练字助手",
    "version": "0.5.1",
    "description": "帮助选择练习内容和模式；网站负责最终预览、下载和打印。姓名模式使用 student_name；汉字、笔顺和古诗使用 text；基础练习不接受文字。服务端与 Skill 使用同一份版本化字帖文档契约。"
  },
  "servers": [
    {
      "url": "https://www.zitieku.com"
    }
  ],
  "paths": {
    "/api/v1/templates": {
      "get": {
        "operationId": "list_templates",
        "summary": "列出可用字帖模板",
        "responses": {
          "200": {
            "description": "字帖方案列表",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "templates": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/worksheet-links": {
      "post": {
        "operationId": "create_worksheet",
        "summary": "按用户目标准备字帖",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "template_id": {
                    "type": "string",
                    "enum": [
                      "standard-copy",
                      "standard-trace",
                      "standard-repeat",
                      "practice-large",
                      "practice-compact",
                      "poetry-full",
                      "poetry-split",
                      "poetry-quadrant",
                      "name-fade",
                      "name-trace",
                      "name-blank",
                      "basic-strokes",
                      "prewriting-lines"
                    ]
                  },
                  "text": {
                    "type": "string",
                    "maxLength": 5000
                  },
                  "student_name": {
                    "type": "string",
                    "maxLength": 12
                  },
                  "student_class": {
                    "type": "string",
                    "maxLength": 30
                  },
                  "student_id": {
                    "type": "string",
                    "maxLength": 30
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "grid_type": {
                    "type": "string",
                    "enum": [
                      "mi",
                      "tian",
                      "square"
                    ]
                  },
                  "columns": {
                    "type": "integer",
                    "minimum": 4,
                    "maximum": 16
                  },
                  "orientation": {
                    "type": "string",
                    "enum": [
                      "portrait",
                      "landscape"
                    ]
                  },
                  "pinyin": {
                    "type": "boolean"
                  },
                  "trace_style": {
                    "type": "string",
                    "enum": [
                      "solid",
                      "hollow"
                    ]
                  },
                  "trace_density": {
                    "type": "string",
                    "enum": [
                      "light",
                      "normal",
                      "dark"
                    ]
                  },
                  "practice_gradient": {
                    "type": "string",
                    "enum": [
                      "classic",
                      "half",
                      "all-trace"
                    ]
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "advisor",
                      "skill",
                      "kimi",
                      "coze",
                      "share",
                      "developer",
                      "mcp"
                    ]
                  }
                },
                "required": [
                  "template_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "配置已准备好；请打开返回的网址预览和打印。",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "status": {
                      "type": "string"
                    },
                    "render_verified": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "输入无效"
          },
          "413": {
            "description": "请求内容过大"
          }
        }
      }
    }
  }
}
