{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "imports-v2/card_planned_relations.json",
  "title": "Card planned relations",
  "description": "A planned relation between the dates of two cards: the successor starts after the predecessor finishes. Both cards need `planned_start` and `planned_end`, otherwise the package is rejected. `gap` with `gap_type` adds a gap between the finish of the predecessor and the start of the successor. Dependencies must not form a cycle, and a chain of more than 255 links is rejected.",
  "type": "object",
  "properties": {
    "external_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512,
      "description": "Your own identifier of the record, for example `k-mrr`, unique within the resource across all of its files and case sensitive. Other records refer to this one by it."
    },
    "predecessor_card_ref": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512,
      "x-ref": "cards",
      "description": "The card that comes first. It must have planned_start and planned_end. Give the external_id of a `cards` record."
    },
    "successor_card_ref": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512,
      "x-ref": "cards",
      "description": "The card that depends on the predecessor. It must have planned_start and planned_end."
    },
    "gap": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": -9007199254740991,
      "maximum": 9007199254740991,
      "description": "Gap between the finish of the predecessor and the start of the successor, in whole units of `gap_type`; use it with `gap_type`."
    },
    "gap_type": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "hours",
        "days",
        null
      ],
      "description": "Unit of `gap`: `hours` or `days`. Use it with `gap`."
    }
  },
  "required": [
    "external_id",
    "predecessor_card_ref",
    "successor_card_ref"
  ],
  "additionalProperties": false,
  "allOf": [
    {
      "dependencies": {
        "gap": [
          "gap_type"
        ],
        "gap_type": [
          "gap"
        ]
      }
    }
  ]
}
