{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$ref": "#/$defs/PatternFile",
  "$defs": {
    "PatternFile": {
      "type": "object",
      "properties": {
        "$schema": {
          "description": "The schema of this file: https://docs.plotwork.dev/schemas/plotwork.pattern.json. Optional.",
          "type": "string"
        },
        "name": {
          "type": "string",
          "description": "The pattern's name: lowercase letters, digits and single hyphens, up to 50 characters, such as payments-service. Its id becomes org:<name>, and it never changes once saved."
        },
        "title": {
          "type": "string",
          "description": "A name people read, up to 80 characters, such as \"Three-tier web app on our landing zone\"."
        },
        "summary": {
          "type": "string",
          "description": "One sentence on what the diagram shows, up to 300 characters. find_pattern matches and shows it."
        },
        "whenToUse": {
          "description": "Two or three sentences: when to start from this pattern, and when not to. Up to 600 characters.",
          "type": "string"
        },
        "tags": {
          "description": "Words a search should match, such as \"web app\" and \"waf\"; at most 12, lowercase.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "templates": {
          "type": "object",
          "properties": {
            "neutral": {
              "description": "The source with generic icons, for any provider.",
              "type": "string"
            },
            "aws": {
              "description": "The source drawn with AWS icons, with provider=aws on its header line.",
              "type": "string"
            },
            "azure": {
              "description": "The source drawn with Azure icons, with provider=azure on its header line.",
              "type": "string"
            },
            "gcp": {
              "description": "The source drawn with Google Cloud icons, with provider=gcp on its header line.",
              "type": "string"
            }
          },
          "additionalProperties": false,
          "description": "Plotwork source for each flavour the pattern comes in; at least one. Every flavour is the same kind of diagram and uses the same slots. Write {{slot-id}} inside a quoted label for each part a team fills in, and leave the parts every team must draw the same (a firewall, an approval, an audit log) as fixed text."
        },
        "slots": {
          "description": "Every {{slot}} the templates use, each once, at most 20. Start with title and description, which name the diagram and give its alt text.",
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "Lowercase words joined with hyphens, such as orders-api. Written {{orders-api}} inside a quoted label of a template."
              },
              "default": {
                "type": "string",
                "description": "The text drawn when an agent gives no value: up to 60 characters, no quotes or line breaks (600 for the description slot)."
              },
              "meaning": {
                "type": "string",
                "description": "One line an agent reads to know what belongs here, such as \"The name of the service the team runs.\""
              }
            },
            "required": [
              "id",
              "default",
              "meaning"
            ],
            "additionalProperties": false
          }
        },
        "notes": {
          "description": "Advice get_pattern gives an agent, each up to 400 characters. Left out, each has a plain default.",
          "type": "object",
          "properties": {
            "keep": {
              "description": "What an agent must leave exactly as it is, and why.",
              "type": "string"
            },
            "rename": {
              "description": "What to rename or replace, and how.",
              "type": "string"
            },
            "split": {
              "description": "When the diagram has grown too big, and where to cut it.",
              "type": "string"
            }
          },
          "additionalProperties": false
        }
      },
      "required": [
        "name",
        "title",
        "summary",
        "templates"
      ],
      "additionalProperties": false,
      "description": "An organisation pattern as one JSON file: its name, words, the source of each flavour with {{slot}} markers, the slots, and advice."
    }
  },
  "$id": "https://docs.plotwork.dev/schemas/plotwork.pattern.json",
  "title": "Plotwork pattern file",
  "description": "An organisation pattern as one JSON file: what an agent writes and check_pattern checks, what publish_pattern saves, what the Patterns tab imports and downloads, and a valid body for POST /orgs/{org}/patterns. Save it as <name>.pattern.json. Fixed parts are plain text in the templates; each part a team fills in is a {{slot}} inside a quoted label, listed in slots."
}
