{% comment %}
  Stripe Customers → `customers` generic_table row.

  Contract B (`resource_type: "generic_table"`, `generic_table_id`
  pinned to the Stripe Customers table). One JSON field per GT column.

  Contract B also carries an `mdm_input_config` (separate template), so
  the platform resolves each row's subject and stamps `legal_entity_id`
  onto the row. `legal_entity_id` is NEVER declared as a column and
  never written here — the stamp is the platform's, and the name is
  reserved, so declaring it 422s this create rather than shadowing it.

  GT columns:
    * `customer_number` — Stripe's customer id (the unique column, so a
      re-fetch updates the same row instead of inserting a duplicate)
    * `customer_type`, `status`, `currency` — commercial state, not PII
    * `name`, `email`, `phone`, `tax_id` — tokenized PII. `tax_id` is
      the KYC gate the dunning workflow filters on, so a template that
      drops it makes every row look KYC-incomplete and the workflow
      filters all of them — green ingest, silently empty outcome.
    * `delinquent` — boolean; Stripe sends the string "false"/"true",
      which renders unquoted here and lands as a real boolean
    * `address_city`, `address_country` — coarse location, not PII
{% endcomment %}
{% assign p = msg %}
{
  "customer_number": "{{ p.customer_number | json_escape }}",
  "customer_type": "{{ p.customer_type | default: "individual" | json_escape }}",
  "status": "{{ p.status | default: "prospect" | json_escape }}",
  "name": "{{ p.name | default: "" | json_escape }}",
  "email": "{{ p.email | default: "" | json_escape }}",
  "phone": "{{ p.phone | default: "" | json_escape }}",
  "tax_id": "{{ p.tax_id | default: "" | json_escape }}",
  "currency": "{{ p.currency | default: "" | json_escape }}",
  "delinquent": {{ p.delinquent | default: "false" }},
  "address_city": "{{ p.address_city | default: "" | json_escape }}",
  "address_country": "{{ p.address_country | default: "" | json_escape }}"
}
