{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://familymoa.store/together/agent/v1/schema/envelope.json",
  "title": "Common envelope of every /together/agent/v1/ JSON endpoint",
  "type": "object",
  "required": [
    "$schema",
    "version",
    "updated",
    "source",
    "checked",
    "license",
    "stale",
    "reportIssue"
  ],
  "properties": {
    "$schema": {
      "type": "string",
      "pattern": "^https://familymoa\\.store/together/agent/v1/schema/[a-z0-9-]+\\.json$"
    },
    "version": {
      "type": "string",
      "pattern": "^sha256-[0-9a-f]{12}$"
    },
    "updated": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "source": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^https://[^\\s]+$"
      }
    },
    "checked": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "license": {
      "type": "string",
      "pattern": "^CC BY 4\\.0 \\(https://creativecommons\\.org/licenses/by/4\\.0/\\); sources: .+$"
    },
    "stale": {
      "type": "boolean"
    },
    "notice": {
      "type": "object",
      "required": [
        "text",
        "originals"
      ],
      "properties": {
        "text": {
          "const": "Not legal or tax advice."
        },
        "originals": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^https://[^\\s]+$"
          }
        }
      },
      "additionalProperties": false
    },
    "reportIssue": {
      "type": "string",
      "pattern": "^mailto:[^\\s@]+@[^\\s@?]+\\?subject=\\S+$"
    },
    "derivedFrom": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^https://familymoa\\.store/together/agent/v1/[^\\s]+$"
      }
    },
    "validUntil": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,6})?Z$"
    },
    "scope": {
      "type": "string"
    }
  }
}
