{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://velacent.com/schemas/ehr-kit/1.0/kit.schema.json",
  "title": "Velacent Bridge EHR connection kit 1.0",
  "description": "A connection kit: the SMART Backend Services connection, flows, steps and test record for one EHR product, next to the interface profile (schemas/profile.schema.json) that carries coverage, conformance rules and route templates. A kit holds no vendor text, sample payloads, logos or credentials. The Go validator (internal/ehrkit) is the strict source of truth.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "id",
    "name",
    "vendor",
    "product",
    "mark",
    "owner",
    "attribution",
    "version",
    "summary",
    "status"
  ],
  "properties": {
    "schema": {
      "const": "https://velacent.com/schemas/ehr-kit/1.0/kit.schema.json"
    },
    "id": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9-]{2,60}$"
    },
    "name": {
      "type": "string",
      "pattern": "^Velacent Bridge connection kit for ",
      "maxLength": 120
    },
    "vendor": {
      "type": "string"
    },
    "product": {
      "type": "string"
    },
    "mark": {
      "type": "string"
    },
    "mark_symbol": {
      "type": "string"
    },
    "owner": {
      "type": "string"
    },
    "attribution": {
      "type": "string",
      "description": "The attribution line: the mark is a trademark of the named owner, and Velacent Bridge is not affiliated with, endorsed by or certified by that owner."
    },
    "version": {
      "type": "string",
      "pattern": "^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$"
    },
    "summary": {
      "type": "string"
    },
    "status": {
      "enum": [
        "published",
        "held"
      ]
    },
    "held_reason": {
      "type": "string"
    },
    "product_versions": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "product",
          "range"
        ],
        "properties": {
          "product": {
            "type": "string"
          },
          "range": {
            "type": "string"
          },
          "fhir": {
            "type": "string"
          }
        }
      }
    },
    "references": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "title",
          "url",
          "accessed",
          "read"
        ],
        "properties": {
          "title": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "pattern": "^https://"
          },
          "accessed": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "basis": {
            "enum": ["baseline"],
            "description": "baseline: accessed is the 2026-11-18 baseline date carried forward, not the date of a real read"
          },
          "read": {
            "type": "boolean"
          }
        }
      }
    },
    "listing": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "url",
        "confirmed",
        "note"
      ],
      "properties": {
        "url": {
          "type": "string",
          "pattern": "^https://"
        },
        "confirmed": {
          "type": "boolean"
        },
        "note": {
          "type": "string"
        }
      }
    },
    "profile": {
      "type": "string"
    },
    "profile_version": {
      "type": "string"
    },
    "auth": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "alg",
        "scope_style",
        "registration",
        "base_url_hint"
      ],
      "properties": {
        "kind": {
          "const": "smart_backend"
        },
        "alg": {
          "enum": [
            "RS384",
            "ES384"
          ]
        },
        "scope_style": {
          "enum": [
            "v1",
            "v2"
          ]
        },
        "registration": {
          "type": "string"
        },
        "base_url_hint": {
          "type": "string"
        }
      }
    },
    "feeds": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "key",
          "flow",
          "kind",
          "description"
        ],
        "properties": {
          "key": {
            "type": "string"
          },
          "flow": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "poll",
              "bulk_export"
            ]
          },
          "query": {
            "type": "string"
          },
          "level": {
            "enum": [
              "system",
              "group",
              "patient"
            ]
          },
          "types": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "interval_seconds": {
            "type": "integer",
            "minimum": 30
          },
          "description": {
            "type": "string"
          }
        }
      }
    },
    "flows": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "key",
          "title",
          "direction",
          "description",
          "resources",
          "feeds"
        ],
        "properties": {
          "key": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "direction": {
            "const": "in"
          },
          "description": {
            "type": "string"
          },
          "resources": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "feeds": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "routes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    },
    "hl7v2": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "transport",
        "basis",
        "description",
        "types",
        "routes"
      ],
      "properties": {
        "transport": {
          "type": "string"
        },
        "basis": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "types": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "type",
              "triggers"
            ],
            "properties": {
              "type": {
                "type": "string"
              },
              "triggers": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        },
        "routes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "families": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "key",
              "title",
              "description",
              "routes"
            ],
            "properties": {
              "key": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "to_system": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "type",
                    "triggers"
                  ],
                  "properties": {
                    "type": {
                      "type": "string"
                    },
                    "triggers": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "from_system": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "type",
                    "triggers"
                  ],
                  "properties": {
                    "type": {
                      "type": "string"
                    },
                    "triggers": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "routes": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        },
        "notes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "not_included": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "terms_note": {
      "type": "string"
    },
    "steps": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "title",
          "owner",
          "milestone",
          "text"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "owner": {
            "enum": [
              "customer_it",
              "customer_integration",
              "velacent"
            ]
          },
          "milestone": {
            "enum": [
              "connectivity",
              "routes",
              "mappings",
              "test",
              "partners",
              "parallel_run",
              "security_review",
              "cutover"
            ]
          },
          "text": {
            "type": "string"
          },
          "link": {
            "type": "string",
            "pattern": "^https://"
          }
        }
      }
    },
    "synthetic": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "hl7v2": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "fhir": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "hl7_version": {
          "type": "string"
        }
      }
    },
    "tested": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "date",
        "against",
        "sandbox"
      ],
      "properties": {
        "date": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        "against": {
          "type": "string"
        },
        "sandbox": {
          "type": "boolean"
        }
      }
    }
  }
}
