{
	"$schema": "https://json-schema.org/draft/2020-12/schema",
	"$id": "https://adspaceatlas.com/standards/adspace/1.0.0/schema.json",
	"title": "Ad Space Manifest 1",
	"description": "Publisher-hosted discovery of public advertising inventory and current commercial terms.",
	"type": "object",
	"additionalProperties": true,
	"required": ["specVersion", "generatedAt", "publisher", "listings"],
	"properties": {
		"$schema": {
			"type": "string",
			"const": "https://adspaceatlas.com/standards/adspace/1.0.0/schema.json"
		},
		"specVersion": { "type": "string", "const": "1" },
		"generatedAt": { "$ref": "#/$defs/dateTime" },
		"language": { "type": "string", "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$", "maxLength": 64 },
		"publisher": { "$ref": "#/$defs/publisher" },
		"collections": {
			"type": "array",
			"maxItems": 250,
			"items": { "$ref": "#/$defs/collection" }
		},
		"listings": {
			"type": "array",
			"maxItems": 250,
			"items": { "$ref": "#/$defs/listing" }
		},
		"links": { "$ref": "#/$defs/links" },
		"extensions": { "$ref": "#/$defs/extensions" }
	},
	"$defs": {
		"dateTime": {
			"type": "string",
			"format": "date-time"
		},
		"httpsUrl": {
			"type": "string",
			"format": "uri",
			"pattern": "^https://",
			"maxLength": 2048
		},
		"id": {
			"type": "string",
			"pattern": "^[A-Za-z0-9][A-Za-z0-9._~-]{0,159}$"
		},
		"openVocabulary": {
			"anyOf": [
				{ "type": "string", "pattern": "^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$" },
				{ "type": "string", "format": "uri" }
			]
		},
		"extensions": {
			"type": "object",
			"propertyNames": { "type": "string", "format": "uri", "pattern": "^https://" },
			"additionalProperties": true
		},
		"identifier": {
			"type": "object",
			"additionalProperties": true,
			"required": ["scheme", "value"],
			"properties": {
				"scheme": { "type": "string", "format": "uri", "maxLength": 2048 },
				"value": { "type": "string", "minLength": 1, "maxLength": 500 }
			}
		},
		"publisher": {
			"type": "object",
			"additionalProperties": true,
			"required": ["name", "url"],
			"properties": {
				"name": { "type": "string", "minLength": 1, "maxLength": 160 },
				"url": { "$ref": "#/$defs/httpsUrl" },
				"description": { "type": "string", "minLength": 1, "maxLength": 2000 },
				"contactUrl": { "$ref": "#/$defs/httpsUrl" },
				"identifiers": {
					"type": "array",
					"maxItems": 50,
					"items": { "$ref": "#/$defs/identifier" }
				},
				"extensions": { "$ref": "#/$defs/extensions" }
			}
		},
		"collection": {
			"type": "object",
			"additionalProperties": true,
			"required": ["id", "name"],
			"properties": {
				"id": { "$ref": "#/$defs/id" },
				"name": { "type": "string", "minLength": 1, "maxLength": 240 },
				"url": { "$ref": "#/$defs/httpsUrl" },
				"description": { "type": "string", "minLength": 1, "maxLength": 4000 },
				"lifecycleStatus": { "$ref": "#/$defs/openVocabulary" },
				"extensions": { "$ref": "#/$defs/extensions" }
			}
		},
		"location": {
			"type": "object",
			"additionalProperties": true,
			"minProperties": 1,
			"properties": {
				"label": { "type": "string", "minLength": 1, "maxLength": 240 },
				"countryCode": { "type": "string", "pattern": "^[A-Z]{2}$" },
				"region": { "type": "string", "minLength": 1, "maxLength": 160 },
				"locality": { "type": "string", "minLength": 1, "maxLength": 160 },
				"extensions": { "$ref": "#/$defs/extensions" }
			}
		},
		"availability": {
			"type": "object",
			"additionalProperties": true,
			"required": ["status", "observedAt"],
			"properties": {
				"status": { "$ref": "#/$defs/openVocabulary" },
				"availableUnits": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
				"totalUnits": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 },
				"observedAt": { "$ref": "#/$defs/dateTime" },
				"extensions": { "$ref": "#/$defs/extensions" }
			}
		},
		"creativeRequirements": {
			"type": "object",
			"additionalProperties": true,
			"minProperties": 1,
			"properties": {
				"description": { "type": "string", "minLength": 1, "maxLength": 4000 },
				"acceptedMediaTypes": {
					"type": "array",
					"maxItems": 50,
					"uniqueItems": true,
					"items": {
						"type": "string",
						"pattern": "^[A-Za-z0-9!#$&^_.+-]+/[A-Za-z0-9!#$&^_.+-]+$",
						"maxLength": 160
					}
				},
				"extensions": { "$ref": "#/$defs/extensions" }
			}
		},
		"placement": {
			"type": "object",
			"additionalProperties": true,
			"required": ["id", "name"],
			"properties": {
				"id": { "$ref": "#/$defs/id" },
				"name": { "type": "string", "minLength": 1, "maxLength": 240 },
				"description": { "type": "string", "minLength": 1, "maxLength": 4000 },
				"surfaceCategory": { "$ref": "#/$defs/openVocabulary" },
				"availability": { "$ref": "#/$defs/availability" },
				"creativeRequirements": { "$ref": "#/$defs/creativeRequirements" },
				"extensions": { "$ref": "#/$defs/extensions" }
			}
		},
		"moneyAmount": {
			"type": "object",
			"additionalProperties": true,
			"required": ["minorUnits", "currency", "basis"],
			"properties": {
				"minorUnits": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
				"currency": { "type": "string", "pattern": "^[A-Z]{3}$" },
				"basis": { "$ref": "#/$defs/openVocabulary" }
			}
		},
		"price": {
			"type": "object",
			"additionalProperties": true,
			"required": ["minorUnits", "currency", "basis", "observedAt"],
			"properties": {
				"minorUnits": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
				"currency": { "type": "string", "pattern": "^[A-Z]{3}$" },
				"basis": { "$ref": "#/$defs/openVocabulary" },
				"observedAt": { "$ref": "#/$defs/dateTime" }
			}
		},
		"commercialObservation": {
			"type": "object",
			"additionalProperties": true,
			"required": ["kind", "money", "observedAt"],
			"properties": {
				"kind": { "$ref": "#/$defs/openVocabulary" },
				"money": { "$ref": "#/$defs/moneyAmount" },
				"observedAt": { "$ref": "#/$defs/dateTime" },
				"extensions": { "$ref": "#/$defs/extensions" }
			}
		},
		"offer": {
			"type": "object",
			"additionalProperties": true,
			"required": ["id", "placementIds", "pricingModel"],
			"properties": {
				"id": { "$ref": "#/$defs/id" },
				"placementIds": {
					"type": "array",
					"minItems": 1,
					"maxItems": 250,
					"uniqueItems": true,
					"items": { "$ref": "#/$defs/id" }
				},
				"pricingModel": { "$ref": "#/$defs/openVocabulary" },
				"price": { "$ref": "#/$defs/price" },
				"salesUrl": { "$ref": "#/$defs/httpsUrl" },
				"validFrom": { "$ref": "#/$defs/dateTime" },
				"validThrough": { "$ref": "#/$defs/dateTime" },
				"observations": {
					"type": "array",
					"maxItems": 50,
					"items": { "$ref": "#/$defs/commercialObservation" }
				},
				"extensions": { "$ref": "#/$defs/extensions" }
			}
		},
		"link": {
			"type": "object",
			"additionalProperties": true,
			"required": ["rel", "href"],
			"properties": {
				"rel": {
					"anyOf": [{ "type": "string", "pattern": "^[a-z][a-z0-9.-]*$" }, { "type": "string", "format": "uri" }],
					"description": "Registered relation token or absolute URI"
				},
				"href": { "$ref": "#/$defs/httpsUrl" },
				"type": { "type": "string", "minLength": 1, "maxLength": 160 },
				"title": { "type": "string", "minLength": 1, "maxLength": 240 }
			}
		},
		"links": {
			"type": "array",
			"maxItems": 50,
			"items": { "$ref": "#/$defs/link" }
		},
		"listing": {
			"type": "object",
			"additionalProperties": true,
			"required": ["id", "name", "medium", "lifecycleStatus", "placements"],
			"properties": {
				"id": { "$ref": "#/$defs/id" },
				"collectionId": { "$ref": "#/$defs/id" },
				"name": { "type": "string", "minLength": 1, "maxLength": 240 },
				"description": { "type": "string", "minLength": 1, "maxLength": 8000 },
				"url": { "$ref": "#/$defs/httpsUrl" },
				"medium": { "$ref": "#/$defs/openVocabulary" },
				"lifecycleStatus": { "$ref": "#/$defs/openVocabulary" },
				"modifiedAt": { "$ref": "#/$defs/dateTime" },
				"location": { "$ref": "#/$defs/location" },
				"placements": {
					"type": "array",
					"minItems": 1,
					"maxItems": 250,
					"items": { "$ref": "#/$defs/placement" }
				},
				"offers": {
					"type": "array",
					"maxItems": 250,
					"items": { "$ref": "#/$defs/offer" }
				},
				"links": { "$ref": "#/$defs/links" },
				"extensions": { "$ref": "#/$defs/extensions" }
			}
		}
	}
}
