# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

######################
# RULE_TEMPLATE_SPEC #
######################
templates:
  - template: nullness_check
    rule:
      name: non-null
      non_null_expectation: {}
      description: Standard nullness check for domain
      dimension: COMPLETENESS
      threshold: 1.0
  - template: uniqueness_check
    rule:
      name: unique
      uniqueness_expectation: {}
      description: Standard uniqueness check for domain
      dimension: UNIQUENESS
      threshold: 1.0
  - template: empty_table_check
    rule:
      name: not-empty-table
      table_condition_expectation:
        sql_expression: COUNT(*) > 0
      description: Non-zero number of rows in the table
      dimension: VALIDITY
  - template: item_row_check
    rule:
      name: item-non-zero
      row_condition_expectation:
        sql_expression: num_of_item > 0
      description: Non-zero number of items in each order
      dimension: VALIDITY
  - template: one_of_allowed_values
    rule:
      name: one-of-values
      set_expectation:
        values:
          - Shipped
          - Complete
          - Processing
          - Cancelled
          - Returned
      description: status is one of allowed values
      dimension: VALIDITY