---
inputType: CA10__CaGoogleCloudKmsCryptoKey__c
testData:
  - file: test-data.json
conditions:
  - status: COMPLIANT
    currentStateMessage: Test-1
    check:
      UNIT_TEST:
        id: Test-1
        arg:
          IS_EMPTY:
            arg:
              DURATION_FROM:
                arg:
                  TEXT: ""
                format: GCP
                undeterminedIf:
                  isEmpty: "Empty text received"
                  invalidFormat: "Should not happen"
  - status: COMPLIANT
    currentStateMessage: Test-2
    check:
      UNIT_TEST:
        id: Test-2
        arg:
          IS_EMPTY:
            arg:
              DURATION_FROM:
                arg:
                  TEXT: "123"
                format: GCP
                undeterminedIf:
                  isEmpty: "Should not happen"
                  invalidFormat: "Invalid value received"
  - status: COMPLIANT
    currentStateMessage: Test-3
    check:
      UNIT_TEST:
        id: Test-3
        arg:
          IS_EQUAL:
            left:
              DURATION_FROM:
                arg:
                  TEXT: "60s"
                format: GCP
                undeterminedIf:
                  isEmpty: "Should not happen"
                  invalidFormat: "Should not happen"
            right:
              DURATION_FROM:
                arg:
                  TEXT: "1m"
                format: GCP
                undeterminedIf:
                  isEmpty: "Should not happen"
                  invalidFormat: "Should not happen"
  - status: COMPLIANT
    currentStateMessage: Test-4
    check:
      UNIT_TEST:
        id: Test-4
        arg:
          IS_EQUAL:
            left:
              DURATION_FROM:
                arg:
                  TEXT: "60m"
                format: GCP
                undeterminedIf:
                  isEmpty: "Should not happen"
                  invalidFormat: "Should not happen"
            right:
              DURATION_FROM:
                arg:
                  TEXT: "1h"
                format: GCP
                undeterminedIf:
                  isEmpty: "Should not happen"
                  invalidFormat: "Should not happen"
  - status: COMPLIANT
    currentStateMessage: Test-5
    check:
      UNIT_TEST:
        id: Test-5
        arg:
          IS_EQUAL:
            left:
              DURATION_FROM:
                arg:
                  TEXT: "24h"
                format: GCP
                undeterminedIf:
                  isEmpty: "Should not happen"
                  invalidFormat: "Should not happen"
            right:
              DURATION_FROM:
                arg:
                  TEXT: "1d"
                format: GCP
                undeterminedIf:
                  isEmpty: "Should not happen"
                  invalidFormat: "Should not happen"  
  - status: COMPLIANT
    currentStateMessage: Test-6
    check:
      UNIT_TEST:
        id: Test-6
        arg:
          IS_EQUAL:
            left:
              DURATION_FROM:
                arg:
                  TEXT: "1s"
                format: GCP
                undeterminedIf:
                  isEmpty: "Should not happen"
                  invalidFormat: "Should not happen"
            right:
              DURATION: "PT1S"
  - status: COMPLIANT
    currentStateMessage: Test-7
    check:
      UNIT_TEST:
        id: Test-7
        arg:
          NOT_EQUAL:
            left:
              DURATION: "P1Y"
            right:
              DURATION: "P365D"
  - status: COMPLIANT
    currentStateMessage: Test-8
    check:
      UNIT_TEST:
        id: Test-8
        arg:
          IS_EQUAL:
            left:
              DURATION: "P1Y"
            right:
              DURATION: "P12M"
  - status: COMPLIANT
    currentStateMessage: Test-9
    check:
      UNIT_TEST:
        id: Test-9
        arg:
          IS_EQUAL:
            left:
              DURATION: "P1M"
            right:
              DURATION: "P30D"
otherwise:
  status: INCOMPLIANT
  currentStateMessage: Test Failed
  remediationMessage: Developer Fix Required