{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://signalshopper.com/signals/schema/provider.schema.json",
 "title": "Signal Shopper provider description",
 "description": "A provider's description of itself: its name, the kind of signal, and the addresses of its ranked list and grid. Serving it lets a person plug the provider in with one address.",
 "type": "object",
 "required": [
  "format",
  "name"
 ],
 "anyOf": [
  {
   "required": [
    "ranked"
   ]
  },
  {
   "required": [
    "grid",
    "symbols"
   ]
  },
  {
   "required": [
    "profile",
    "symbols"
   ]
  }
 ],
 "properties": {
  "format": {
   "const": "signalshopper.provider/1"
  },
  "name": {
   "type": "string",
   "minLength": 1
  },
  "kind": {
   "type": "string",
   "minLength": 1,
   "description": "The kind of signal, for example \"Pricing engine\". Providers of one kind are grouped in the picker."
  },
  "description": {
   "type": "string",
   "minLength": 1
  },
  "ranked": {
   "type": "string",
   "pattern": "\\{side\\}",
   "description": "Address of the ranked list, with {side} where buy or sell goes. Relative addresses are read against this description's own address."
  },
  "grid": {
   "type": "string",
   "pattern": "\\{symbol\\}",
   "description": "Address of the grid, with {symbol} where the symbol goes."
  },
  "profile": {
   "type": "string",
   "pattern": "\\{symbol\\}",
   "description": "Address of the profile, with {symbol} where the symbol goes."
  },
  "symbols": {
   "type": "array",
   "minItems": 1,
   "items": {
    "type": "string",
    "minLength": 1
   },
   "description": "The symbols a grid or a profile is served for. Required with either."
  }
 },
 "dependentRequired": {
  "grid": [
   "symbols"
  ],
  "profile": [
   "symbols"
  ]
 }
}
