{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/vendure/refs/heads/main/json-schema/vendure-customer-schema.json",
  "title": "Vendure Customer",
  "description": "JSON Schema representation of a Vendure Customer entity as exposed by the Shop and Admin GraphQL APIs.",
  "type": "object",
  "required": ["id", "emailAddress"],
  "properties": {
    "id": { "type": "string" },
    "createdAt": { "type": "string", "format": "date-time" },
    "updatedAt": { "type": "string", "format": "date-time" },
    "title": { "type": "string" },
    "firstName": { "type": "string" },
    "lastName": { "type": "string" },
    "emailAddress": { "type": "string", "format": "email" },
    "phoneNumber": { "type": "string" },
    "user": {
      "type": "object",
      "properties": {
        "id": { "type": "string" },
        "identifier": { "type": "string" },
        "verified": { "type": "boolean" },
        "lastLogin": { "type": "string", "format": "date-time" }
      }
    },
    "addresses": {
      "type": "array",
      "items": { "$ref": "#/$defs/Address" }
    },
    "groups": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" }
        }
      }
    },
    "orders": {
      "type": "object",
      "properties": {
        "totalItems": { "type": "integer" },
        "items": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": { "type": "string" },
              "code": { "type": "string" },
              "state": { "type": "string" },
              "totalWithTax": { "type": "integer" }
            }
          }
        }
      }
    },
    "customFields": {
      "type": "object",
      "additionalProperties": true
    }
  },
  "$defs": {
    "Address": {
      "type": "object",
      "properties": {
        "id": { "type": "string" },
        "fullName": { "type": "string" },
        "company": { "type": "string" },
        "streetLine1": { "type": "string" },
        "streetLine2": { "type": "string" },
        "city": { "type": "string" },
        "province": { "type": "string" },
        "postalCode": { "type": "string" },
        "country": {
          "type": "object",
          "properties": {
            "id": { "type": "string" },
            "code": { "type": "string", "pattern": "^[A-Z]{2}$" },
            "name": { "type": "string" }
          }
        },
        "phoneNumber": { "type": "string" },
        "defaultShippingAddress": { "type": "boolean" },
        "defaultBillingAddress": { "type": "boolean" }
      }
    }
  }
}
