{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.ferretlang.org/registry/artifact/module/v1.json",
  "title": "Ferret Registry Module Artifact v1",
  "description": "The public metadata and version references for one generated Ferret Registry module.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "id",
    "owner",
    "name",
    "description",
    "versions"
  ],
  "properties": {
    "schemaVersion": {
      "const": 1
    },
    "id": {
      "$ref": "https://schemas.ferretlang.org/common/identifier.json"
    },
    "owner": {
      "$ref": "#/$defs/nameSegment"
    },
    "name": {
      "$ref": "#/$defs/nameSegment"
    },
    "description": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "pattern": "^[^\\r\\n]+$"
    },
    "latest": {
      "$ref": "https://schemas.ferretlang.org/common/semver.json"
    },
    "versions": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "$ref": "#/$defs/versionReference"
      }
    }
  },
  "$defs": {
    "nameSegment": {
      "type": "string",
      "pattern": "^[a-z0-9]([a-z0-9._-]*[a-z0-9])?$"
    },
    "versionReference": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "version",
        "publishedAt",
        "href"
      ],
      "properties": {
        "version": {
          "$ref": "https://schemas.ferretlang.org/common/semver.json"
        },
        "publishedAt": {
          "type": "string",
          "format": "date-time",
          "pattern": "Z$"
        },
        "href": {
          "type": "string",
          "minLength": 1,
          "format": "uri-reference",
          "pattern": "^[^?#\\r\\n]+$"
        }
      }
    }
  }
}
