{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://objectsgrid.com/.well-known/objects-catalog/Person/v1/schema.json",
  "title": "Person",
  "description": "Objects Grid Person Object. A person: a customer, an author of a Review or Rating, a member of an Organization, or the person behind a UserAccount. Personal fields (x-objectsgrid-personal) are encrypted at rest, never in events, search or webhooks, and erased on request (POST /persons/{id}/erasure). Modeled in compliance with https://schema.org/Person.",
  "x-objectsgrid-jsonLd": false,
  "type": "object",
  "unevaluatedProperties": false,
  "properties": {
    "id": {
      "description": "The unique identifier for Person. Assigned by the server.",
      "type": [
        "string",
        "null"
      ],
      "minLength": 0,
      "maxLength": 50,
      "readOnly": true
    },
    "at_context": {
      "description": "Schema context",
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "https://schema.org"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "at_type": {
      "description": "The object type",
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "Person"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "at_id": {
      "description": "This Person'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
    },
    "identifier": {
      "description": "The unique identifier for Person. Assigned by the server.",
      "type": [
        "string",
        "null"
      ],
      "minLength": 0,
      "maxLength": 50,
      "readOnly": true
    },
    "url": {
      "description": "This Person URL. Assigned by the server.",
      "type": [
        "string",
        "null"
      ],
      "format": "uri",
      "minLength": 1,
      "readOnly": true
    },
    "name": {
      "description": "The person's full name, as they want to be addressed. Personal: an order field.",
      "type": [
        "string",
        "null"
      ],
      "minLength": 1,
      "maxLength": 200,
      "x-objectsgrid-personal": "order"
    },
    "givenName": {
      "description": "Given name. Personal: an order field.",
      "type": [
        "string",
        "null"
      ],
      "minLength": 1,
      "maxLength": 100,
      "x-objectsgrid-personal": "order"
    },
    "familyName": {
      "description": "Family name. Personal: an order field.",
      "type": [
        "string",
        "null"
      ],
      "minLength": 1,
      "maxLength": 100,
      "x-objectsgrid-personal": "order"
    },
    "additionalName": {
      "description": "An additional name, such as a middle name. Personal: an order field.",
      "type": [
        "string",
        "null"
      ],
      "minLength": 1,
      "maxLength": 100,
      "x-objectsgrid-personal": "order"
    },
    "email": {
      "description": "Email address. Personal: an order field. Exact lookups: GET /persons?email=",
      "type": [
        "string",
        "null"
      ],
      "format": "email",
      "maxLength": 254,
      "x-objectsgrid-personal": "order"
    },
    "telephone": {
      "description": "Telephone number, in E.164 form (+4930123456). Personal: an order field. Exact lookups: GET /persons?telephone=",
      "type": [
        "string",
        "null"
      ],
      "pattern": "^\\+[1-9][0-9]{6,14}$",
      "x-objectsgrid-personal": "order"
    },
    "address": {
      "description": "Postal address. Personal: an order field. Its country, region, city and postal area are kept, anonymised, in demographics.",
      "anyOf": [
        {
          "$ref": "https://objectsgrid.com/.well-known/objects-catalog/PostalAddress/v1/schema.json"
        },
        {
          "type": "null"
        }
      ],
      "x-objectsgrid-personal": "order"
    },
    "birthDate": {
      "description": "Date of birth. Personal. Its year is kept, anonymised, in demographics.",
      "type": [
        "string",
        "null"
      ],
      "format": "date",
      "x-objectsgrid-personal": true
    },
    "jobTitle": {
      "description": "Job title. Personal: at a small company it identifies its holder.",
      "type": [
        "string",
        "null"
      ],
      "maxLength": 200,
      "x-objectsgrid-personal": true
    },
    "worksFor": {
      "x-objectsgrid-personal": true,
      "description": "URLs of the Organizations the person works for. Personal: at a small company they identify the person.",
      "x-objectsgrid-rangeIncludes": [
        "Organization"
      ],
      "type": [
        "array",
        "null"
      ],
      "maxItems": 20,
      "items": {
        "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
      }
    },
    "roles": {
      "description": "The Person's roles at businesses. ObjectsGrid's own field. Computed, read-only: the objects whose EmployeeRole.employee points to this object, listed from that type; never stored or written.",
      "x-objectsgrid-inverseOf": "EmployeeRole.employee",
      "readOnly": true
    },
    "gender": {
      "description": "Gender, as the person states it, e.g. Female, Male or free text.",
      "type": [
        "string",
        "null"
      ],
      "maxLength": 50
    },
    "knowsLanguage": {
      "description": "Languages the person knows, as BCP 47 language codes (en, de-AT).",
      "type": [
        "array",
        "null"
      ],
      "maxItems": 20,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "pattern": "^[A-Za-z]{2,3}(-[A-Za-z0-9]{1,8})*$"
      }
    },
    "memberOf": {
      "description": "URLs of the programmes and tiers (schema.org MemberProgramTier) or Organizations the person is a member of, e.g. a loyalty tier.",
      "x-objectsgrid-rangeIncludes": [
        "MemberProgramTier",
        "Organization"
      ],
      "type": [
        "array",
        "null"
      ],
      "maxItems": 50,
      "items": {
        "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
      }
    },
    "demographics": {
      "description": "Anonymous fields derived from the personal ones on every write, kept after erasure for marketing analysis. Assigned by the server. Marketing reports hide any group smaller than 10 people.",
      "type": [
        "object",
        "null"
      ],
      "readOnly": true,
      "unevaluatedProperties": false,
      "properties": {
        "birthYear": {
          "description": "Year of birth; 90 and over is the year 90 years before this one",
          "type": [
            "integer",
            "null"
          ]
        },
        "addressCountry": {
          "description": "Country of the address, ISO 3166-1 alpha-2",
          "type": [
            "string",
            "null"
          ]
        },
        "addressRegion": {
          "description": "Region or state of the address",
          "type": [
            "string",
            "null"
          ]
        },
        "addressLocality": {
          "description": "City of the address",
          "type": [
            "string",
            "null"
          ]
        },
        "postalCodePrefix": {
          "description": "Postal area only: the UK outward code, 3 digits in the US, 2 in Germany, France and the Netherlands; none elsewhere",
          "type": [
            "string",
            "null"
          ]
        },
        "gender": {
          "description": "As in gender",
          "type": [
            "string",
            "null"
          ]
        },
        "knowsLanguage": {
          "description": "As in knowsLanguage",
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string"
          }
        },
        "loyaltyTiers": {
          "description": "The MemberProgramTiers of memberOf",
          "x-objectsgrid-rangeIncludes": [
            "MemberProgramTier"
          ],
          "type": [
            "array",
            "null"
          ],
          "items": {
            "$ref": "https://objectsgrid.com/.well-known/objects-catalog/Reference/v1/schema.json"
          }
        },
        "customerSince": {
          "description": "Year and month the Person was created, YYYY-MM",
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "erasedAt": {
      "description": "When the person was erased (GDPR Art. 17): the personal fields are then null in every version, and only accounting may still read the order fields of versions Orders point to. Assigned by the server.",
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "readOnly": true
    },
    "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
    },
    "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"
      }
    }
  }
}
