---
inputType: "CA10__CaGoogleGceDisk__c"
importExtracts:
  - file: "/types/CA10__CaGoogleGceDisk__c/object.extracts.yaml"
testData:
  - file: 'test-data.json'
conditions:
  - status: "INAPPLICABLE"
    currentStateMessage: "The Disk has been created less than 30 days ago."
    check:
      IS_WITHIN_LAST_DAYS:
        offsetDays: 30
        arg:
          EXTRACT: "CA10__creationDate__c"
  - status: "INCOMPLIANT"
    currentStateMessage: "The Disk hasn't been attached to a VM since creation."
    check:
      IS_EMPTY:
        arg:
          EXTRACT: "CA10__lastAttach__c"
  - status: "INAPPLICABLE"
    currentStateMessage: "The Disk is not persistent."
    check:
      RELATED_LIST_HAS:
        status: "INAPPLICABLE"
        relationshipName: "CA10__Google_GCE_Attached_Disks__r"
  - status: "COMPLIANT"
    currentStateMessage: "The Disk is attached to a VM."
    check:
      RELATED_LIST_HAS:
        status: "COMPLIANT"
        relationshipName: "CA10__Google_GCE_Attached_Disks__r"
  - status: "COMPLIANT"
    currentStateMessage: "The Disk is attached to a VM."
    check:
      IS_EMPTY:
        arg:
          EXTRACT: "CA10__lastDetach__c"
  - status: "COMPLIANT"
    currentStateMessage: "The Disk was detached within the last 30 days."
    check:
      IS_WITHIN_LAST_DAYS:
        offsetDays: 30
        arg:
          EXTRACT: "CA10__lastDetach__c"
  - status: "INCOMPLIANT"
    currentStateMessage: "The Disk was detached more than 30 days ago."
    check:
      IS_BEYOND_LAST_DAYS:
        offsetDays: 30
        arg:
          EXTRACT: "CA10__lastDetach__c"
otherwise:
  status: "UNDETERMINED"
  currentStateMessage: "Unexpected values in the fields."
relatedLists:
  - relationshipName: "CA10__Google_GCE_Attached_Disks__r"
    importExtracts:
      - file: "/types/CA10__CaGoogleGceAttachedDisk__c/object.extracts.yaml"
    conditions:
      - status: "INAPPLICABLE"
        currentStateMessage: "The Disk is not persistent."
        check:
          NOT_EQUAL:
            left:
              EXTRACT: "CA10__type__c"
            right:
              TEXT: "PERSISTENT"
    otherwise:
      status: "COMPLIANT"
      currentStateMessage: "The Disk is attached to a VM."
