{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://interchange.stellarview.net/schemas/mappings/tags.schema.json",
  "title": "Mapping: tags. Data, editable in Setup, versioned, each with its source.",
  "type": "object",
  "required": [
    "mapping",
    "version",
    "updated",
    "updated_by",
    "source",
    "items"
  ],
  "additionalProperties": false,
  "properties": {
    "mapping": {
      "const": "tags"
    },
    "version": {
      "type": "integer",
      "minimum": 1
    },
    "updated": {
      "type": "string"
    },
    "updated_by": {
      "type": "string",
      "minLength": 1
    },
    "about": {
      "type": "string"
    },
    "source": {
      "type": "object",
      "required": [
        "cite"
      ],
      "additionalProperties": false,
      "properties": {
        "cite": {
          "type": "string",
          "minLength": 1
        },
        "read": {
          "type": "string"
        }
      }
    },
    "items": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "when",
          "jira",
          "i3_code",
          "source"
        ],
        "additionalProperties": false,
        "properties": {
          "when": {
            "type": "object",
            "minProperties": 1,
            "additionalProperties": false,
            "properties": {
              "system": {
                "type": "string"
              },
              "asset_class": {
                "type": "string"
              }
            }
          },
          "jira": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "labels": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[^\\s]+$"
                }
              },
              "components": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "i3_code": {
            "type": "object",
            "required": [
              "state"
            ],
            "additionalProperties": false,
            "properties": {
              "state": {
                "enum": [
                  "to_confirm",
                  "confirmed"
                ]
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "value": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "field": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "note": {
                "type": "string"
              }
            }
          },
          "source": {
            "type": "object",
            "required": [
              "cite"
            ],
            "additionalProperties": false,
            "properties": {
              "cite": {
                "type": "string",
                "minLength": 1
              },
              "read": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}
