{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://objectsgrid.com/.well-known/objects-catalog/Rating/v1/schema.json",
  "title": "Rating",
  "description": "Objects Grid Rating Object. An individual rating given to an item, e.g. 4 out of 5 stars. A Rating is a standalone object and can be provided with or without a Review. Modeled in compliance with https://schema.org/Rating.",
  "type": "object",
  "properties": {
    "at_context": {
      "description": "Schema context",
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "https://schema.org"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "at_type": {
      "description": "The object type",
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "Rating"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "at_id": {
      "description": "This Rating's ObjectsGrid URL, https://apis.objectsgrid.com/<path>/<id>: its JSON-LD @id, which References point to. Set by the service.",
      "type": [
        "string",
        "null"
      ],
      "format": "uri",
      "readOnly": true
    },
    "id": {
      "description": "The unique identifier for Rating. Assigned by the server.",
      "type": [
        "string",
        "null"
      ],
      "minLength": 0,
      "maxLength": 50,
      "readOnly": true
    },
    "identifier": {
      "description": "The unique identifier for Rating. Assigned by the server.",
      "type": [
        "string",
        "null"
      ],
      "minLength": 0,
      "maxLength": 50,
      "readOnly": true
    },
    "url": {
      "description": "This Rating URL. Assigned by the server.",
      "type": [
        "string",
        "null"
      ],
      "format": "uri",
      "minLength": 1,
      "readOnly": true
    },
    "itemReviewed": {
      "x-objectsgrid-erasure": "keep",
      "description": "URL of the item being rated, e.g. a Product, Service, Organization or Place. Objects Grid extension: schema.org defines itemReviewed on Review and AggregateRating; it is required here because a Rating can exist without a Review.",
      "x-objectsgrid-rangeIncludes": [
        "Product",
        "ProductGroup",
        "ProductModel",
        "Service",
        "Organization",
        "Place",
        "Brand",
        "Offer"
      ],
      "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
    },
    "author": {
      "x-objectsgrid-erasure": "keep",
      "description": "URL of the Person or Organization that provided the Rating",
      "x-objectsgrid-rangeIncludes": [
        "Person",
        "Organization"
      ],
      "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
    },
    "ratingValue": {
      "description": "The rating given to the item. Must be between worstRating and bestRating.",
      "type": "number"
    },
    "bestRating": {
      "description": "The highest value allowed in this rating system",
      "type": [
        "number",
        "null"
      ],
      "default": 5
    },
    "worstRating": {
      "description": "The lowest value allowed in this rating system",
      "type": [
        "number",
        "null"
      ],
      "default": 1
    },
    "ratingExplanation": {
      "description": "A short explanation of the reasoning behind the rating value",
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "https://objectsgrid.com/.well-known/objects-catalog/LanguageTaggedString/v1/schema.json"
      }
    },
    "reviewAspect": {
      "description": "The aspect of the item being rated, e.g. 'quality', 'price', 'delivery'",
      "type": [
        "string",
        "null"
      ],
      "minLength": 0,
      "maxLength": 50
    },
    "tags": {
      "description": "Tags an ABAC policy can decide on. A name may repeat; the same name and value appear once. Every stored object has them: created empty when not sent, kept by a replacement (PUT) that does not mention them, unchanged by a patch that does not mention them, cleared by null or [].",
      "type": "array",
      "default": [],
      "uniqueItems": true,
      "maxItems": 50,
      "items": {
        "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Tag/v1/schema.json"
      }
    },
    "meta": {
      "description": "System-managed metadata for the object (version, audit fields). Assigned by the server.",
      "$ref": "https://objectsgrid.com/.well-known/objects-catalog/ObjectMeta/v1/schema.json",
      "readOnly": true
    }
  },
  "required": [
    "itemReviewed",
    "author",
    "ratingValue"
  ],
  "unevaluatedProperties": false
}
