{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schema.whispir.com/common-0.0.0",
  "title": "Whispir Common Schema Definitions",
  "description": "A collection of common schema definitions used by other Whispir schemas",
  "$defs": {
    "awsRegion": {
      "type": "string",
      "pattern": "^[a-z]{2}-[a-z]+-[1-9]\\d*$",
      "title": "AWS Region Code",
      "examples": ["ap-southeast-2", "us-east-1"]
    },
    "awsTags": {
      "type": "object",
      "propertyNames": {
        "$ref": "#/$defs/awsTagKey"
      },
      "patternProperties": {
        "": {
          "$ref": "#/$defs/awsTagValue"
        }
      },
      "title": "AWS Tags",
      "description": "A collection of AWS tags",
      "$comment": "The empty property name in patternProperties is match-all regex"
    },
    "awsTagKey": {
      "type": "string",
      "pattern": "^(?!aws:)[a-zA-Z +=._:/@-]{1,128}$",
      "title": "AWS Tag Key",
      "description": "Generally allowed keys for AWS tags",
      "$comment": "See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html#tag-restrictions"
    },
    "awsTagValue": {
      "type": "string",
      "maxLength": 256,
      "title": "AWS Tag Value",
      "description": "Generally allowed values for AWS tags",
      "$comment": "See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html#tag-restrictions"
    },
    "dockerContainerLongId": {
      "type": "string",
      "pattern": "^[a-fA-F0-9]{64}",
      "title": "Docker Container Long Identifier",
      "description": "A full 256-bit Docker container ID in 64 hexadecimal digits"
    },
    "dockerContainerShortId": {
      "type": "string",
      "pattern": "^[a-zA-Z0-9]{12}",
      "title": "Docker Container Short Identifier",
      "description": "A truncated 24-bit Docker container ID in 12 hexadecimal digits"
    },
    "gitCommitHash": {
      "type": "string",
      "pattern": "^[a-fA-F0-9]{40}",
      "title": "Get Commit Hash",
      "description": "A 40 character string representing the SHA-1 hash of a git commit."
    },
    "semVer": {
      "type": "string",
      "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$",
      "title": "Semantic Version (SemVer)",
      "description": "Supports the full Semantic Version 2.0.0 format: major.minor.patch-pre+build\nWhere:\n * major, minor and patch are all required (pre and build are optional); and\n * major, minor and patch must be unsigned integers (ie no signs present; and\n * major, minor and patch must not begin with `0`, unless precisely `0`; and\n * pre and build are both dot-separated lists of identifiers; and\n * pre and build identifiers must contain alphanumeric and hyphen characters only; and\n * pre identifiers must:\n   * include at least one non-digit character; or\n   * not begin with `0`; or\n   * be precisel `0`\nSee https://regex101.com/r/vkijKf/1/ for some valid (and invalid) examples.",
      "$comment": "See https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string"
    },
    "severity": {
      "type": "string",
      "enum": ["DEBUG", "INFO", "NOTICE", "WARNING", "ERROR", "CRITICAL", "ALERT", "EMERGENCY"],
      "title": "Severity Level",
      "description": "RFC 5424 6.2.1. Table 2. Syslog Message Severities"
    },
    "uuid": {
      "type": "string",
      "format": "uuid",
      "title": "Formal UUID String",
      "description": "RFC 4122 3. Declaration of syntactic structure",
      "$comment": "'uuid' format added in JSON Schema draft 2019-09."
    },
    "xrayTraceId": {
      "type": "string",
      "pattern": "^1-[a-fA-F0-9]{8}-[a-fA-F0-9]{24}$",
      "title": "AWS X-Ray Trace ID",
      "description": "Trace ID compatible with the AWS X-Ray service",
      "$comment": "See https://docs.aws.amazon.com/xray/latest/devguide/xray-api-sendingdata.html#xray-api-traceids"
    }
  }
}
