cubes:
  - name: order_fulfillment
    sql_table: inventory_v2.order_fulfillment
    data_source: default

    joins:
      - name: order
        sql: "{CUBE}.order_id = {order.id}"
        relationship: many_to_one

      - name: site
        sql: "{CUBE}.site_id = {site.id}"
        relationship: many_to_one

    dimensions:
      - name: id
        sql: id
        type: number
        primary_key: true

      - name: external_fulfillment_id
        sql: external_fulfillment_id
        type: string

      - name: external_order_id
        sql: external_order_id
        type: string

      - name: items
        sql: items
        type: string

      - name: shipping_method
        sql: shipping_method
        type: string

      - name: shipping_provider
        sql: shipping_provider
        type: string

      - name: status
        sql: status
        type: string

      - name: tracking_number
        sql: tracking_number
        type: string

      - name: created_at
        sql: created_at
        type: time

      - name: date_created
        sql: date_created
        type: time

      - name: updated_at
        sql: updated_at
        type: time

    measures:
      - name: count
        type: count

    pre_aggregations:
      # Pre-aggregation definitions go here.
      # Learn more in the documentation: https://cube.dev/docs/caching/pre-aggregations/getting-started

