version: 2

models:
  - name: fct_refunds_processed
    description: >
      The fct_refunds_processed table is a fact table containing information about processed refunds for a shop.
    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_refund_line_key
        description: >
          The unique refund line key created by SourceMedium that can be used to join refund line dimensions to related tables.
        tests:
          - not_null
          - unique

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

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

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

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

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

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

      - name: order_line_id
        description: >
          The ID of the order line.

      - name: order_id
        description: >
          The ID of the order.

      - name: refunded_at
        description: >
          The autogenerated date and time when the refund was processed.
        tests:
          - not_null

      - name: refunded_at_local_datetime
        description: >
          The autogenerated date and time when the refund was processed, converted to the reporting timezone configured in SourceMedium.

      - 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

      - name: order_line_refund_quantity
        description: >
          The quantity of order lines that were refunded. This value is always negative.

      - name: shipping_refunds
        description: >
          The amount of shipping refunds applied to an order.

      - name: shipping_tax_refunds
        description: >
          The amount of shipping tax refunds applied to an order.

      - name: order_line_refunds
        description: >
          The amount of order line refunds applied to an order.

      - name: order_line_tax_refunds
        description: >
          The amount of order line tax refunds applied to an order.

      - name: order_duty_refunds
        description: >
          The amount of order duty refunds applied to an order.

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