{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://vizcatalogue.dev/schema/cp.schema.json",
  "title": "Component spec",
  "type": "object",
  "required": ["code", "name", "ovp_version", "purpose", "params", "roles", "sample", "golden_canvas", "golden_origin", "rules", "qa"],
  "properties": {
    "code": {"type": "string", "pattern": "^CP-[A-Z]{3}-[0-9]{2}$"},
    "name": {"type": "string", "minLength": 2},
    "ovp_version": {"type": "string", "pattern": "^[01]\\.[0-9]+$"},
    "purpose": {"type": "string", "minLength": 10},
    "params": {"type": "object"},
    "roles": {
      "type": "object",
      "additionalProperties": {"type": "array", "items": {"type": "string"}, "minItems": 1}
    },
    "sample": {"type": "object"},
    "golden_canvas": {
      "type": "object",
      "required": ["w", "h"],
      "properties": {"w": {"type": "integer"}, "h": {"type": "integer"}}
    },
    "golden_origin": {
      "type": "object",
      "required": ["x", "y"],
      "properties": {"x": {"type": "number"}, "y": {"type": "number"}}
    },
    "rules": {"type": "array", "items": {"type": "string"}, "minItems": 1},
    "qa": {"type": "array", "items": {"type": "string"}, "minItems": 1}
  }
}
