{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "https://schema.hagicode.com/schemas/prompts.schema.json",
  "title": "Prompt Template",
  "type": "object",
  "description": "PCode prompt template configuration for YAML files",
  "additionalProperties": false,
  "properties": {
    "Metadata": {
      "description": "提示词元数据",
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/definitions/PromptMetadata"
        }
      ]
    },
    "SystemPrompt": {
      "type": [
        "null",
        "string"
      ],
      "description": "系统提示词"
    },
    "UserPromptTemplate": {
      "type": [
        "null",
        "string"
      ],
      "description": "用户提示词模板（可包含参数占位符）"
    },
    "EmbeddedCommand": {
      "type": [
        "null",
        "string"
      ],
      "description": "内嵌命令内容（可选）"
    }
  },
  "definitions": {
    "PromptMetadata": {
      "type": "object",
      "description": "提示词元数据 (V2 - JSON format for new Scriban templates)",
      "additionalProperties": false,
      "properties": {
        "Scenario": {
          "type": "string",
          "description": "场景名称"
        },
        "Locale": {
          "type": "string",
          "description": "语言区域设置 (BCP 47 format, e.g., \"zh-CN\", \"en-US\")"
        },
        "Version": {
          "type": "string",
          "description": "版本号 (semantic version format, e.g., \"2.0.0\")"
        },
        "TemplateRef": {
          "type": [
            "null",
            "string"
          ],
          "description": "Optional reference to a shared template file.\nIf omitted, defaults to same filename with .scriban extension."
        },
        "Syntax": {
          "type": "string",
          "description": "Template syntax type (default: \"handlebars\")"
        },
        "SyntaxVersion": {
          "type": [
            "null",
            "string"
          ],
          "description": "Syntax version for future compatibility"
        },
        "Parameters": {
          "type": "array",
          "description": "Parameter definitions for the template",
          "items": {
            "$ref": "#/definitions/PromptParameter"
          }
        },
        "LastModified": {
          "type": [
            "null",
            "string"
          ],
          "description": "最后修改日期 (ISO 8601 format)"
        },
        "Author": {
          "type": [
            "null",
            "string"
          ],
          "description": "作者"
        },
        "Description": {
          "type": [
            "null",
            "string"
          ],
          "description": "描述"
        },
        "Tags": {
          "type": "array",
          "description": "Classification tags for the prompt",
          "items": {
            "type": "string"
          }
        },
        "EmbeddedCommand": {
          "type": [
            "null",
            "string"
          ],
          "description": "Optional embedded command content (for OpenSpec commands)"
        },
        "Source": {
          "description": "Source of the prompt (Default or Override)",
          "oneOf": [
            {
              "$ref": "#/definitions/PromptSource"
            }
          ]
        },
        "LastModifiedAt": {
          "type": [
            "null",
            "string"
          ],
          "description": "Last modified timestamp for the prompt file",
          "format": "date-time"
        }
      }
    },
    "PromptParameter": {
      "type": "object",
      "description": "Represents a parameter definition in prompt metadata",
      "additionalProperties": false,
      "properties": {
        "Name": {
          "type": "string",
          "description": "Parameter name"
        },
        "Type": {
          "type": "string",
          "description": "Parameter type (string, int, bool, array, object)"
        },
        "Required": {
          "type": "boolean",
          "description": "Whether the parameter is required"
        },
        "Description": {
          "type": [
            "null",
            "string"
          ],
          "description": "Parameter description"
        }
      }
    },
    "PromptSource": {
      "type": "integer",
      "description": "Defines the source location for a prompt template.",
      "x-enumNames": [
        "Default",
        "Override"
      ],
      "enum": [
        0,
        1
      ]
    }
  }
}