{
  "baseEntity": {
    "key": "entity",
    "name": "Entity",
    "description": "Identity shared by every business entity.",
    "version": "0.1.0",
    "properties": [
      {
        "key": "id",
        "name": "ID",
        "description": "Opaque, case-sensitive identifier in the system holding this record.",
        "type": "string",
        "required": true
      },
      {
        "key": "external_references",
        "name": "External references",
        "description": "References keyed by vendor/type. Each key holds a list of IDs with optional routing keys identifying accounts or brands within that namespace.",
        "type": "value",
        "value": "external_reference",
        "many": true,
        "list": true
      }
    ]
  },
  "entities": [
    {
      "base": "entity",
      "key": "customer",
      "name": "Customer",
      "pluralName": "Customers",
      "description": "A person or organization with a potential, current or former customer relationship with the business.",
      "version": "0.1.0",
      "properties": [
        {
          "key": "party_type",
          "name": "Party type",
          "description": "Whether the customer is an individual or an organization.",
          "type": "enum",
          "required": true,
          "options": {
            "individual": "Individual",
            "organization": "Organization"
          }
        },
        {
          "key": "lifecycle_stage",
          "name": "Lifecycle stage",
          "description": "The overall commercial relationship, independent of account status. A prospect is a qualified lead; a former customer previously had an established customer relationship.",
          "type": "enum",
          "required": true,
          "options": {
            "customer": "Customer",
            "disqualified": "Disqualified",
            "former_customer": "Former customer",
            "lead": "Lead",
            "prospect": "Prospect"
          }
        },
        {
          "key": "lead_temperature",
          "name": "Lead temperature",
          "description": "Current interest or engagement, independent of qualification. Omit when unknown or not applicable.",
          "type": "enum",
          "options": {
            "cold": "Cold",
            "hot": "Hot",
            "warm": "Warm"
          }
        },
        {
          "key": "qualification_stage",
          "name": "Qualification stage",
          "description": "The qualification reached by a lead or prospect. Omit when unknown or not applicable.",
          "type": "enum",
          "options": {
            "marketing_qualified": "Marketing qualified",
            "sales_qualified": "Sales qualified",
            "unqualified": "Unqualified"
          }
        },
        {
          "key": "status",
          "name": "Account status",
          "description": "The operational account state, independent of lifecycle, billing and payment state. Set explicitly when creating an account.",
          "type": "enum",
          "required": true,
          "options": {
            "active": "Active",
            "closed": "Closed",
            "inactive": "Inactive",
            "pending": "Pending",
            "suspended": "Suspended"
          }
        },
        {
          "key": "commercial_model",
          "name": "Commercial model",
          "description": "How the account is offered. Free means no payment is expected; freemium offers a free tier with paid upgrades. None means no commercial offering applies.",
          "type": "enum",
          "options": {
            "free": "Free",
            "freemium": "Freemium",
            "none": "None",
            "paid": "Paid"
          }
        },
        {
          "key": "billing_stage",
          "name": "Billing stage",
          "description": "The account billing relationship. Cancellation does not itself end access or close the account. For multiple subscriptions this is an account summary; individual subscription states remain separate.",
          "type": "enum",
          "options": {
            "cancelled": "Cancelled",
            "none": "None",
            "paying": "Paying",
            "trial": "Trial"
          }
        },
        {
          "key": "payment_status",
          "name": "Payment status",
          "description": "Whether account payment obligations are met. None means no obligation applies; current means obligations are met; past due means a payment is overdue; delinquent means it meets the business's escalation policy. This is an account summary when several subscriptions exist.",
          "type": "enum",
          "options": {
            "current": "Current",
            "delinquent": "Delinquent",
            "none": "None",
            "past_due": "Past due"
          }
        },
        {
          "key": "is_test_account",
          "name": "Test account",
          "description": "True for an account used for testing rather than a real customer relationship.",
          "type": "boolean"
        },
        {
          "key": "display_name",
          "name": "Name",
          "description": "The name shown for this customer.",
          "type": "string",
          "required": true,
          "pii": true
        },
        {
          "key": "primary_contact",
          "name": "Primary contact",
          "description": "The main person to contact: the customer themselves for an individual, or their representative for an organization.",
          "type": "value",
          "value": "person",
          "pii": true
        },
        {
          "key": "organization",
          "name": "Organization",
          "description": "The organization, when the customer is one.",
          "type": "value",
          "value": "organization"
        },
        {
          "key": "email",
          "name": "Email",
          "type": "string",
          "format": "email",
          "pii": true,
          "compare": "case-insensitive",
          "matchKey": true,
          "sameAs": "https://schema.org/email"
        },
        {
          "key": "phone",
          "name": "Phone",
          "type": "string",
          "format": "phone",
          "pii": true,
          "secure": true,
          "sameAs": "https://schema.org/telephone"
        },
        {
          "key": "addresses",
          "name": "Addresses",
          "description": "Keyed by role, such as billing or shipping.",
          "type": "value",
          "value": "address",
          "pii": true,
          "many": true
        },
        {
          "key": "country",
          "name": "Country",
          "type": "string",
          "format": "country",
          "compare": "case-insensitive"
        },
        {
          "key": "timezone",
          "name": "Timezone",
          "description": "IANA timezone identifier, such as Europe/London.",
          "type": "string"
        },
        {
          "key": "language",
          "name": "Language",
          "type": "string",
          "format": "language",
          "compare": "case-insensitive"
        },
        {
          "key": "currency",
          "name": "Currency",
          "type": "string",
          "format": "currency",
          "compare": "case-insensitive"
        }
      ],
      "actions": [
        {
          "key": "create",
          "name": "Create customer",
          "emits": [
            "created"
          ]
        },
        {
          "key": "update",
          "name": "Update customer",
          "description": "Change customer details. Use change_status or change_lifecycle for account status and lifecycle changes.",
          "emits": [
            "updated"
          ]
        },
        {
          "key": "change_status",
          "name": "Status change",
          "description": "Change account status without changing the lifecycle stage.",
          "emits": [
            "status_changed"
          ]
        },
        {
          "key": "change_lifecycle",
          "name": "Lifecycle change",
          "description": "Change lifecycle stage without changing account status.",
          "emits": [
            "lifecycle_changed"
          ]
        }
      ],
      "events": [
        {
          "key": "created",
          "name": "Customer created"
        },
        {
          "key": "updated",
          "name": "Customer updated"
        },
        {
          "key": "status_changed",
          "name": "Status changed",
          "description": "The account status changed."
        },
        {
          "key": "lifecycle_changed",
          "name": "Lifecycle changed",
          "description": "The commercial relationship moved to another lifecycle stage."
        }
      ]
    }
  ],
  "values": [
    {
      "key": "address",
      "name": "Address",
      "description": "A postal address, with who it is addressed to.",
      "version": "0.1.0",
      "sameAs": "https://schema.org/PostalAddress",
      "properties": [
        {
          "key": "recipient",
          "name": "Recipient",
          "description": "The person post is addressed to.",
          "type": "string",
          "pii": true
        },
        {
          "key": "organization",
          "name": "Organization",
          "type": "string"
        },
        {
          "key": "line1",
          "name": "Address line 1",
          "type": "string",
          "pii": true,
          "secure": true
        },
        {
          "key": "line2",
          "name": "Address line 2",
          "type": "string",
          "pii": true,
          "secure": true
        },
        {
          "key": "line3",
          "name": "Address line 3",
          "type": "string",
          "pii": true,
          "secure": true
        },
        {
          "key": "city",
          "name": "Town or city",
          "type": "string",
          "pii": true,
          "sameAs": "https://schema.org/addressLocality"
        },
        {
          "key": "region",
          "name": "County, state or region",
          "type": "string",
          "pii": true,
          "sameAs": "https://schema.org/addressRegion"
        },
        {
          "key": "postal_code",
          "name": "Postal code",
          "type": "string",
          "pii": true,
          "secure": true,
          "compare": "case-insensitive",
          "sameAs": "https://schema.org/postalCode"
        },
        {
          "key": "country",
          "name": "Country",
          "type": "string",
          "format": "country",
          "compare": "case-insensitive",
          "sameAs": "https://schema.org/addressCountry"
        }
      ]
    },
    {
      "key": "external_reference",
      "name": "External reference",
      "description": "An opaque ID in another system, optionally scoped to an account or brand.",
      "version": "0.1.0",
      "properties": [
        {
          "key": "id",
          "name": "ID",
          "description": "Opaque, case-sensitive identifier assigned by the external system.",
          "type": "string",
          "required": true
        },
        {
          "key": "routing_key",
          "name": "Routing key",
          "description": "Identifies the account or brand within the vendor/type namespace. Omit when routing is unambiguous.",
          "type": "string"
        }
      ]
    },
    {
      "key": "organization",
      "name": "Organization",
      "description": "A company or other legal body, and how it is registered.",
      "version": "0.1.0",
      "sameAs": "https://schema.org/Organization",
      "properties": [
        {
          "key": "name",
          "name": "Name",
          "description": "The name the organization trades under.",
          "type": "string",
          "sameAs": "https://schema.org/name"
        },
        {
          "key": "legal_name",
          "name": "Legal name",
          "description": "The registered name, when it differs.",
          "type": "string",
          "sameAs": "https://schema.org/legalName"
        },
        {
          "key": "registration_number",
          "name": "Registration number",
          "description": "The company number from its registry.",
          "type": "string",
          "compare": "case-insensitive"
        },
        {
          "key": "tax_number",
          "name": "Tax number",
          "description": "Such as a VAT or EIN number.",
          "type": "string",
          "compare": "case-insensitive",
          "sameAs": "https://schema.org/taxID"
        },
        {
          "key": "website",
          "name": "Website",
          "type": "string",
          "format": "url",
          "compare": "case-insensitive",
          "sameAs": "https://schema.org/url"
        }
      ]
    },
    {
      "key": "person",
      "name": "Person",
      "description": "An individual: how they are named and when they were born.",
      "version": "0.1.0",
      "sameAs": "https://schema.org/Person",
      "properties": [
        {
          "key": "title",
          "name": "Title",
          "description": "Such as Ms, Dr or Prof.",
          "type": "string",
          "pii": true,
          "sameAs": "https://schema.org/honorificPrefix"
        },
        {
          "key": "given_name",
          "name": "Given name",
          "type": "string",
          "pii": true,
          "sameAs": "https://schema.org/givenName"
        },
        {
          "key": "middle_name",
          "name": "Middle name",
          "type": "string",
          "pii": true,
          "sameAs": "https://schema.org/additionalName"
        },
        {
          "key": "family_name",
          "name": "Family name",
          "type": "string",
          "pii": true,
          "sameAs": "https://schema.org/familyName"
        },
        {
          "key": "suffix",
          "name": "Suffix",
          "description": "Such as Jr or PhD.",
          "type": "string",
          "pii": true,
          "sameAs": "https://schema.org/honorificSuffix"
        },
        {
          "key": "preferred_name",
          "name": "Preferred name",
          "description": "What the person likes to be called.",
          "type": "string",
          "pii": true
        },
        {
          "key": "date_of_birth",
          "name": "Date of birth",
          "type": "date",
          "pii": true,
          "secure": true,
          "sameAs": "https://schema.org/birthDate"
        }
      ]
    }
  ]
}
