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

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

      - name: stock_point
        sql: "{CUBE}.stock_point_id = {stock_point.id}"
        relationship: many_to_one

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

      - name: bol_number
        sql: bol_number
        type: string

      - name: customs_invoice_url
        sql: customs_invoice_url
        type: string

      - name: labels
        sql: labels
        type: string

      - name: pickup_confirmation_number
        sql: pickup_confirmation_number
        type: string

      - name: primary_tracking_number
        sql: primary_tracking_number
        type: string

      - name: rate
        sql: rate
        type: string

      - name: return_tracking_number
        sql: return_tracking_number
        type: string

      - name: state
        sql: state
        type: string

      - name: tracking_id
        sql: tracking_id
        type: string

      - name: tracking_numbers
        sql: tracking_numbers
        type: string

      - name: tracking_provider
        sql: tracking_provider
        type: string

      - name: tracking_url
        sql: tracking_url
        type: string

      - name: transaction_number
        sql: transaction_number
        type: string

      - name: type
        sql: type
        type: string

      - name: unique_id
        sql: unique_id
        type: string

      - name: createdat
        sql: "{CUBE}.`createdAt`"
        type: time

      - name: updatedat
        sql: "{CUBE}.`updatedAt`"
        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

