version: 2

models:
  - name: obt_customers
    description: >
      The obt_customers table is SourceMedium's out-of-the-box, "BI-ready" table that contains fully joined customer facts and customer dimensions
      for a shop. This "One Big Table" (OBT) is a denormalized table that is designed to be developer friendly.
    columns:
      - name: smcid
        description: >
          The SourceMedium ID of a store, which is derived from the store's myshopify.com domain.
        tests:
          - not_null

      - name: sm_customer_key
        description: >
          The unique customer key created by SourceMedium that can be used to join customer dimensions to related tables.
        tests:
          - not_null
          - unique

      - name: source_system
        description: >
          The e-commerce source system used to facilitate a customer's order.
        tests:
          - not_null

      - name: customer_id
        description: >
          The ID of the customer who placed the order.
        tests:
          - not_null

      - name: customer_created_at
        description: >
          The autogenerated date and time when the customer was created.

      - name: customer_updated_at
        description: >
          The autogenerated date and time when the customer was last modified.

      - name: customer_email
        description: >
          The customer's email.

      - name: customer_email_hashed
        description: >
          The customer's email hashed.

      - name: customer_first_name
        description: >
          The customer's first name.

      - name: customer_last_name
        description: >
          The customer's last name.

      - name: customer_tags_csv
        description: >
          An aggregated list of all tags associated with a customer.

      - name: customer_tags_array
        description: >
          An aggregated list of all tags associated with a customer in an array format.

      - name: has_customer_consented_to_marketing
        description: >
          Whether the customer has consented to receive marketing communications.

      - name: is_customer_email_verified
        description: >
          Whether the customer's email has been verified.

      - name: _synced_at
        description: >
          The date and time when SourceMedium last successfully synced the row of data.
        tests:
          - not_null

      - name: first_order_id
        description: >
          The ID of the customer's first order.

      - name: last_order_id
        description: >
          The ID of the customer's last order.

      - name: subscription_source_system
        description: >
          The e-commerce source_system used to facilitate a customer's subscription.

      - name: active_subscriptions
        description: >
          The number of active subscriptions associated with a customer.

      - name: subscriber_id
        description: >
          The ID of the subscriber.

      - name: subscriber_status
        description: >
          The status of the subscriber.

      - name: subscriber_created_at
        description: >
          The autogenerated date and time when the subscriber was created.

      - name: active_subscription_count
        description: >
          The number of active subscriptions associated with a customer.

      - name: customer_street_address
        description: >
          The customer's street address.

      - name: customer_address_city
        description: >
          The city of customer's location.

      - name: customer_address_country
        description: >
          The country of the customer's location.

      - name: customer_address_province
        description: >
          The province, state, or district code of the customer's location.

      - name: customer_address_zip_code
        description: >
          The postal code of the customer's location.