version: 2
models:
  - name: FAN_DATA_DELETION_REPORT_DBT
    description: '{{ doc("FAN_DATA_DELETION_REPORT_DBT") }}'
    data_tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - DELETED_DATE
            - BASED_ON
    columns:
      - name: DELETED_DATE
        description: Date
        data_tests:
          - not_null
      - name: DELETED_FAN_COUNT
        description: Nr of unique fans deleted
        data_tests:
          - not_null
      - name: BASED_ON
        description: Fans deleted based on
        data_tests:
          - not_null
  - name: FAN_DATA_DELETION_LOG_DBT
    description: '{{ doc("FAN_DATA_DELETION_LOG_DBT") }}'
    data_tests:
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - DELETED_AT
            - BASED_ON
    columns:
      - name: DELETED_FAN_IDS
        description: Array containing fan ids
        data_tests:
          - not_null
      - name: BASED_ON
        description: Fans deleted based on
        data_tests:
          - not_null
  - name: FAN_EMAIL_DELETION_REQUEST_DBT
    description: '{{ doc("FAN_EMAIL_DELETION_REQUEST_DBT") }}'
    data_tests:
      - dbt_expectations.expect_table_row_count_to_be_between:
          min_value: 1
      - dbt_utils.unique_combination_of_columns:
          combination_of_columns:
            - FAN_ID
    columns:
      - name: FAN_ID
        description: Id representing fan (SHA256 of a lowercase fan email)
        data_tests:
          - not_null
      - name: DATA_DELETED_AT
        description: Latest fan deletion request date
        data_tests:
          - not_null
  - name: FAN_CRM_ID_DELETION_REQUEST_DBT
    description: '{{ doc("FAN_CRM_ID_DELETION_REQUEST_DBT") }}'
    data_tests:
      - dbt_expectations.expect_table_row_count_to_be_between:
          min_value: 1
    columns:
      - name: CRM_FAN_ID
        description: Id representing crm fan
        data_tests:
          - not_null
          - unique
