{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://heartcortex.ai/schemas/1.0/custom-definition.schema.json",
  "title": "Custom definition (write form)",
  "description": "What must be supplied to create a definition. Names are reverse-DNS.",
  "allOf": [
    {
      "$ref": "custom.schema.json"
    }
  ],
  "required": [
    "name",
    "kind",
    "description",
    "privacy",
    "native"
  ],
  "properties": {
    "name": {
      "type": "string",
      "pattern": "^[a-z0-9]+(\\.[a-z0-9-]+){2,}(\\.[a-z0-9_-]+)?$"
    },
    "actionId": {
      "description": "Request only, never stored: the Action ID the client chose (API Standard 6.3).",
      "$ref": "common.schema.json#/$defs/actionId"
    },
    "presence": {
      "description": "Request only, never stored: proof of presence for the digest of the Action named by actionId (API Standard 6.3).",
      "$ref": "common.schema.json#/$defs/presence"
    }
  },
  "if": {
    "properties": {
      "kind": {
        "const": "command"
      }
    }
  },
  "then": {
    "required": [
      "inputSchema",
      "risk"
    ]
  },
  "else": {
    "if": {
      "properties": {
        "kind": {
          "const": "property"
        }
      }
    },
    "then": {
      "required": [
        "valueSchema"
      ]
    },
    "else": {
      "required": [
        "rhythmName"
      ]
    }
  }
}
