{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://objectsgrid.com/.well-known/objects-catalog/Cart/v1/schema.json",
  "title": "Cart",
  "description": "Objects Grid Cart Object. What a shopper intends to buy: Offers and how many of each. A read of one cart adds each line's current price and the totals; POST /carts/{id}/checkout turns it into an Order at those prices. A cart expires 30 days after its last change unless expires says otherwise, and reads 404 after it. ObjectsGrid's own type: Schema.org has no cart. It has no JSON-LD document.",
  "x-objectsgrid-jsonLd": false,
  "type": "object",
  "properties": {
    "at_type": {
      "description": "The object type",
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "Cart"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "at_id": {
      "description": "This Cart'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 Cart. Assigned by the server.",
      "type": [
        "string",
        "null"
      ],
      "minLength": 0,
      "maxLength": 50,
      "readOnly": true
    },
    "identifier": {
      "description": "The unique identifier for Cart. Assigned by the server.",
      "type": [
        "string",
        "null"
      ],
      "minLength": 0,
      "maxLength": 50,
      "readOnly": true
    },
    "url": {
      "description": "This Cart URL. Assigned by the server.",
      "type": [
        "string",
        "null"
      ],
      "format": "uri",
      "minLength": 1,
      "readOnly": true
    },
    "seller": {
      "x-objectsgrid-erasure": "keep",
      "description": "The shop the cart is with",
      "x-objectsgrid-rangeIncludes": [
        "Organization"
      ],
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "customer": {
      "x-objectsgrid-erasure": "keep",
      "description": "The shopper, when known; none for a guest. Checkout uses it as the Order's customer",
      "x-objectsgrid-rangeIncludes": [
        "Organization",
        "Person"
      ],
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
        },
        {
          "type": "null"
        }
      ]
    },
    "cartItem": {
      "description": "The lines: an Offer and how many of it",
      "type": "array",
      "maxItems": 100,
      "items": {
        "type": "object",
        "properties": {
          "offer": {
            "description": "The Offer the shopper intends to buy",
            "x-objectsgrid-rangeIncludes": [
              "Offer"
            ],
            "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
          },
          "quantity": {
            "description": "How many; 1 when not given",
            "type": [
              "number",
              "null"
            ],
            "exclusiveMinimum": 0
          },
          "price": {
            "description": "The Offer's current price for one. Computed on a read of the cart, never stored.",
            "type": [
              "number",
              "null"
            ],
            "readOnly": true
          },
          "priceCurrency": {
            "description": "The Offer's currency. Computed on a read of the cart, never stored.",
            "type": [
              "string",
              "null"
            ],
            "readOnly": true
          }
        },
        "required": [
          "offer"
        ],
        "unevaluatedProperties": false
      }
    },
    "discountCode": {
      "description": "A DiscountCode the shopper entered, in any case. A read shows its discount in totalPrice and discount, or why it doesn't apply in discountRefused; checkout checks it again, counts the use and passes the code and the discount to the Order. A code no DiscountCode has is passed to the Order unapplied, for codes an app runs itself.",
      "type": [
        "string",
        "null"
      ],
      "maxLength": 100
    },
    "expires": {
      "description": "When the cart expires: 30 days after its last change when not given. After it, reads answer 404",
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "totalPrice": {
      "description": "The sum of the lines' prices, per currency, less the discount. Computed on a read of the cart, never stored.",
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "https://objectsgrid.com/.well-known/objects-catalog/MonetaryAmount/v1/schema.json"
      },
      "readOnly": true
    },
    "checkedOut": {
      "description": "Whether the cart was checked out; it can't change after. Set by the service.",
      "type": [
        "boolean",
        "null"
      ],
      "readOnly": true
    },
    "order": {
      "description": "The Order the checkout created. Set by the service.",
      "x-objectsgrid-rangeIncludes": [
        "Order"
      ],
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
        },
        {
          "type": "null"
        }
      ],
      "readOnly": true
    },
    "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
    },
    "discount": {
      "description": "What the discountCode takes off, per currency. Computed on a read of the cart, never stored.",
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "https://objectsgrid.com/.well-known/objects-catalog/MonetaryAmount/v1/schema.json"
      },
      "readOnly": true
    },
    "discountRefused": {
      "description": "Why the discountCode doesn't apply, e.g. expired or used up. Computed on a read of the cart, never stored.",
      "type": [
        "string",
        "null"
      ],
      "readOnly": true
    }
  },
  "required": [
    "cartItem"
  ],
  "unevaluatedProperties": false
}
