---
policy: /ce/ca/azure/sql-database/database-underutilized
logic: /ce/ca/azure/sql-database/database-underutilized/prod.logic.yaml
executionTime: 2025-10-01T12:47:04.223181321Z
generationMs: 64
executionMs: 763
rows:
  - id: test1
    match: true
    status:
      expected: DISAPPEARED
      actual: DISAPPEARED
    conditionIndex:
      expected: 99
      actual: 99
    conditionText:
      expected: isDisappeared(CA10__disappearanceTime__c)
      actual: isDisappeared(CA10__disappearanceTime__c)
    runtimeError: {}
  - id: test2
    match: true
    status:
      expected: INAPPLICABLE
      actual: INAPPLICABLE
    conditionIndex:
      expected: 399
      actual: 399
    conditionText:
      expected: extract('CA10__kind__c').contains('system')
      actual: extract('CA10__kind__c').contains('system')
    runtimeError: {}
  - id: test3
    match: true
    status:
      expected: INAPPLICABLE
      actual: INAPPLICABLE
    conditionIndex:
      expected: 499
      actual: 499
    conditionText:
      expected: extract('CA10__satus__c') != 'Online'
      actual: extract('CA10__satus__c') != 'Online'
    runtimeError: {}
  - id: test4
    match: true
    status:
      expected: INAPPLICABLE
      actual: INAPPLICABLE
    conditionIndex:
      expected: 599
      actual: 599
    conditionText:
      expected: extract('CA10__creationDate__c').withinLastDays(30)
      actual: extract('CA10__creationDate__c').withinLastDays(30)
    runtimeError: {}
  - id: test5
    match: true
    status:
      expected: INAPPLICABLE
      actual: INAPPLICABLE
    conditionIndex:
      expected: 699
      actual: 699
    conditionText:
      expected: extract('CA10__pausedDate__c').withinLastDays(30)
      actual: extract('CA10__pausedDate__c').withinLastDays(30)
    runtimeError: {}
  - id: test6
    match: true
    status:
      expected: UNDETERMINED
      actual: UNDETERMINED
    conditionIndex:
      expected: 799
      actual: 799
    conditionText:
      expected: extract('CA10__monitorCpuPercentAvg30Day__c').isEmpty() || extract('CA10__monitorStoragePercentMax30Day__c').isEmpty()
      actual: extract('CA10__monitorCpuPercentAvg30Day__c').isEmpty() || extract('CA10__monitorStoragePercentMax30Day__c').isEmpty()
    runtimeError: {}
  - id: test7
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 899
      actual: 899
    conditionText:
      expected: extract('CA10__monitorDtuConsumptionPercentAvg30Day__c').isNotEmpty()
        && extract('CA10__monitorDtuConsumptionPercentAvg30Day__c') < number(20.0)
        && extract('CA10__monitorStoragePercentMax30Day__c') < number(10.0)
      actual: extract('CA10__monitorDtuConsumptionPercentAvg30Day__c').isNotEmpty()
        && extract('CA10__monitorDtuConsumptionPercentAvg30Day__c') < number(20.0)
        && extract('CA10__monitorStoragePercentMax30Day__c') < number(10.0)
    runtimeError: {}
  - id: test8
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 999
      actual: 999
    conditionText:
      expected: extract('CA10__monitorAppMemoryPercentAvg30Day__c').isNotEmpty() &&
        extract('CA10__monitorAppMemoryPercentAvg30Day__c') < number(40.0) && extract('CA10__monitorCpuPercentAvg30Day__c')
        < number(20.0) && extract('CA10__monitorStoragePercentMax30Day__c') < number(10.0)
      actual: extract('CA10__monitorAppMemoryPercentAvg30Day__c').isNotEmpty() &&
        extract('CA10__monitorAppMemoryPercentAvg30Day__c') < number(40.0) && extract('CA10__monitorCpuPercentAvg30Day__c')
        < number(20.0) && extract('CA10__monitorStoragePercentMax30Day__c') < number(10.0)
    runtimeError: {}
  - id: test9
    match: true
    status:
      expected: INCOMPLIANT
      actual: INCOMPLIANT
    conditionIndex:
      expected: 1099
      actual: 1099
    conditionText:
      expected: extract('CA10__monitorDtuConsumptionPercentAvg30Day__c').isEmpty()
        && extract('CA10__monitorAppMemoryPercentAvg30Day__c').isEmpty() && extract('CA10__monitorCpuPercentAvg30Day__c')
        < number(20.0) && extract('CA10__monitorStoragePercentMax30Day__c') < number(10.0)
      actual: extract('CA10__monitorDtuConsumptionPercentAvg30Day__c').isEmpty() &&
        extract('CA10__monitorAppMemoryPercentAvg30Day__c').isEmpty() && extract('CA10__monitorCpuPercentAvg30Day__c')
        < number(20.0) && extract('CA10__monitorStoragePercentMax30Day__c') < number(10.0)
    runtimeError: {}
  - id: test10
    match: true
    status:
      expected: COMPLIANT
      actual: COMPLIANT
    conditionIndex:
      expected: 1100
      actual: 1100
    conditionText:
      expected: otherwise
      actual: otherwise
    runtimeError: {}
  - id: test11
    match: true
    status:
      expected: INAPPLICABLE
      actual: INAPPLICABLE
    conditionIndex:
      expected: 199
      actual: 199
    conditionText:
      expected: extract('CA10__skuName__c') == 'ElasticPool'
      actual: extract('CA10__skuName__c') == 'ElasticPool'
    runtimeError: {}
  - id: test12
    match: true
    status:
      expected: INAPPLICABLE
      actual: INAPPLICABLE
    conditionIndex:
      expected: 299
      actual: 299
    conditionText:
      expected: extract('CA10__kind__c').contains('serverless')
      actual: extract('CA10__kind__c').contains('serverless')
    runtimeError: {}
usedFiles:
  - path: /ce/ca/azure/sql-database/database-underutilized/policy.yaml
    md5Hash: AD6EF10170A2787639FBEEACD5AAF6E7
    content: |-
      ---
      names:
        full: Azure SQL Database is underutilized
        contextual: Database is underutilized
      description: "Identify Azure SQL Databases that are underutilized to optimize costs\
        \ and improve efficiency. Instances are considered underutilized if their\
        \ average DTU, CPU utilization is consistently below 20%, or App Memory utilization\
        \ is below 40%, and storage utilization is below 10% over a 30-day period."
      type: "COMPLIANCE_POLICY"
      categories:
        - "COST"
        - "PERFORMANCE"
      frameworkMappings:
        - "/frameworks/cloudaware/cost-efficiency-and-optimization/resource-right-sizing"
        - "/frameworks/cloudaware/resource-performance/workload-efficiency"
  - path: /ce/ca/azure/sql-database/database-underutilized/prod.logic.yaml
    md5Hash: 9996DAE202CE26A2FE71F2BB6163CDF5
    content: "---\ninputType: \"CA10__CaAzureSqlDatabase__c\"\nimportExtracts:\n \
      \ - file: \"/types/CA10__CaAzureSqlDatabase__c/object.extracts.yaml\"\ntestData:\n\
      \  - file: 'test-data.json'\nconditions:\n  - status: \"INAPPLICABLE\"\n   \
      \ currentStateMessage: \"This database belongs to an Elastic Pool.\"\n    check:\n\
      \      IS_EQUAL:\n        left: \n          EXTRACT: \"CA10__skuName__c\"\n\
      \        right:\n          TEXT: \"ElasticPool\"\n  - status: \"INAPPLICABLE\"\
      \n    currentStateMessage: \"This is a serverless database.\"\n    check:\n\
      \      CONTAINS:\n        arg: \n          EXTRACT: \"CA10__kind__c\"\n    \
      \    search:\n          TEXT: \"serverless\"\n  - status: \"INAPPLICABLE\"\n\
      \    currentStateMessage: \"This is a master database.\"\n    check:\n     \
      \ CONTAINS:\n        arg: \n          EXTRACT: \"CA10__kind__c\"\n        search:\n\
      \          TEXT: \"system\"\n  - status: \"INAPPLICABLE\"\n    currentStateMessage:\
      \ \"The database is not online.\"\n    check:\n      NOT_EQUAL:\n        left:\n\
      \          EXTRACT: \"CA10__satus__c\"\n        right:\n          TEXT: \"Online\"\
      \n  - status: \"INAPPLICABLE\"\n    currentStateMessage: \"The database was\
      \ created in the last 30 days.\"\n    check:\n      IS_WITHIN_LAST_DAYS:\n \
      \       offsetDays: 30\n        arg:\n          EXTRACT: \"CA10__creationDate__c\"\
      \n  - status: \"INAPPLICABLE\"\n    currentStateMessage: \"The database was\
      \ paused in the last 30 days.\"\n    check:\n      IS_WITHIN_LAST_DAYS:\n  \
      \      offsetDays: 30\n        arg:\n          EXTRACT: \"CA10__pausedDate__c\"\
      \n  - status: \"UNDETERMINED\"\n    currentStateMessage: \"There is not enough\
      \ data in the CMDB to identify if the\\\n      \\ database is underutilized.\"\
      \n    check:  \n      OR:\n        args:\n          - IS_EMPTY:\n          \
      \    arg:\n                EXTRACT: \"CA10__monitorCpuPercentAvg30Day__c\"\n\
      \          - IS_EMPTY:\n              arg:\n                EXTRACT: \"CA10__monitorStoragePercentMax30Day__c\"\
      \n  - status: \"INCOMPLIANT\"\n    currentStateMessage: \"The database DTU consumption\
      \ is less than 20% and storage\\\n      \\ utilization is less than 10%.\"\n\
      \    remediationMessage: \"Consider rightsizing the database.\"\n    check:\n\
      \      AND:\n        args:\n          - NOT_EMPTY:\n              arg:\n   \
      \             EXTRACT: \"CA10__monitorDtuConsumptionPercentAvg30Day__c\"\n \
      \         - LESS_THAN:\n              left:\n                EXTRACT: \"CA10__monitorDtuConsumptionPercentAvg30Day__c\"\
      \n              right:\n                NUMBER: 20.0\n          - LESS_THAN:\n\
      \              left:\n                EXTRACT: \"CA10__monitorStoragePercentMax30Day__c\"\
      \n              right:\n                NUMBER: 10.0\n  - status: \"INCOMPLIANT\"\
      \n    currentStateMessage: \"The database CPU utilization is less than 20%,\
      \ App Memory\\\n      \\ utilization < 40%, and storage utilization is less\
      \ than 10%.\"\n    remediationMessage: \"Consider rightsizing the database.\"\
      \n    check:\n      AND:\n        args:\n          - NOT_EMPTY:\n          \
      \    arg:\n                EXTRACT: \"CA10__monitorAppMemoryPercentAvg30Day__c\"\
      \n          - LESS_THAN:\n              left:\n                EXTRACT: \"CA10__monitorAppMemoryPercentAvg30Day__c\"\
      \n              right:\n                NUMBER: 40.0\n          - LESS_THAN:\n\
      \              left:\n                EXTRACT: \"CA10__monitorCpuPercentAvg30Day__c\"\
      \n              right:\n                NUMBER: 20.0\n          - LESS_THAN:\n\
      \              left:\n                EXTRACT: \"CA10__monitorStoragePercentMax30Day__c\"\
      \n              right:\n                NUMBER: 10.0\n  - status: \"INCOMPLIANT\"\
      \n    currentStateMessage: \"The database CPU is less than 20% and storage utilization\
      \ is less than 10%.\"\n    remediationMessage: \"Consider rightsizing the database.\"\
      \n    check:\n      AND:\n        args:\n          - IS_EMPTY:\n           \
      \   arg:\n                EXTRACT: \"CA10__monitorDtuConsumptionPercentAvg30Day__c\"\
      \n          - IS_EMPTY:\n              arg:\n                EXTRACT: \"CA10__monitorAppMemoryPercentAvg30Day__c\"\
      \n          - LESS_THAN:\n              left:\n                EXTRACT: \"CA10__monitorCpuPercentAvg30Day__c\"\
      \n              right:\n                NUMBER: 20.0\n          - LESS_THAN:\n\
      \              left:\n                EXTRACT: \"CA10__monitorStoragePercentMax30Day__c\"\
      \n              right:\n                NUMBER: 10.0\notherwise:\n  status:\
      \ \"COMPLIANT\"\n  currentStateMessage: \"The database is not underutilized.\""
  - path: /ce/ca/azure/sql-database/database-underutilized/test-data.json
    md5Hash: 19E59C702707EB7545A9108E8119FE1F
    content: |-
      [
          {
              "expectedResult": {
                  "status": "DISAPPEARED",
                  "conditionIndex": "99",
                  "conditionText": "isDisappeared(CA10__disappearanceTime__c)",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2025-09-15T09:48:55Z"
              },
              "Id": "test1",
              "CA10__disappearanceTime__c": "2025-09-12T23:10:53Z",
              "CA10__skuName__c": "ElasticPool",
              "CA10__satus__c": "Online",
              "CA10__kind__c": "vcore",
              "CA10__creationDate__c": "2023-04-04T07:54:57Z",
              "CA10__pausedDate__c": null,
              "CA10__monitorCpuPercentAvg30Day__c": null,
              "CA10__monitorStoragePercentMax30Day__c": 0,
              "CA10__monitorDtuConsumptionPercentAvg30Day__c": 0,
              "CA10__monitorAppMemoryPercentAvg30Day__c": null
          },
          {
              "expectedResult": {
                  "status": "INAPPLICABLE",
                  "conditionIndex": "399",
                  "conditionText": "extract('CA10__kind__c').contains('system')",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2025-09-15T09:48:55Z"
              },
              "Id": "test2",
              "CA10__disappearanceTime__c": null,
              "CA10__skuName__c": "System",
              "CA10__satus__c": "Online",
              "CA10__kind__c": "vcore,system",
              "CA10__creationDate__c": "2019-02-20T09:20:28Z",
              "CA10__pausedDate__c": null,
              "CA10__monitorCpuPercentAvg30Day__c": null,
              "CA10__monitorStoragePercentMax30Day__c": null,
              "CA10__monitorDtuConsumptionPercentAvg30Day__c": null,
              "CA10__monitorAppMemoryPercentAvg30Day__c": null
          },
          {
              "expectedResult": {
                  "status": "INAPPLICABLE",
                  "conditionIndex": "499",
                  "conditionText": "extract('CA10__satus__c') != 'Online'",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2025-09-15T09:48:55Z"
              },
              "Id": "test3",
              "CA10__disappearanceTime__c": null,
              "CA10__skuName__c": "GP_S_Gen5",
              "CA10__satus__c": "Paused",
              "CA10__kind__c": "vcore",
              "CA10__creationDate__c": "2020-05-26T23:17:04Z",
              "CA10__pausedDate__c": "2025-08-05T04:32:40Z",
              "CA10__monitorCpuPercentAvg30Day__c": null,
              "CA10__monitorStoragePercentMax30Day__c": null,
              "CA10__monitorDtuConsumptionPercentAvg30Day__c": null,
              "CA10__monitorAppMemoryPercentAvg30Day__c": null
          },
          {
              "expectedResult": {
                  "status": "INAPPLICABLE",
                  "conditionIndex": "599",
                  "conditionText": "extract('CA10__creationDate__c').withinLastDays(30)",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2025-09-15T09:48:55Z"
              },
              "Id": "test4",
              "CA10__disappearanceTime__c": null,
              "CA10__skuName__c": "Basic",
              "CA10__satus__c": "Online",
              "CA10__kind__c": "vcore",
              "CA10__creationDate__c": "2025-08-19T03:48:33Z",
              "CA10__pausedDate__c": null,
              "CA10__monitorCpuPercentAvg30Day__c": null,
              "CA10__monitorStoragePercentMax30Day__c": 1,
              "CA10__monitorDtuConsumptionPercentAvg30Day__c": 1,
              "CA10__monitorAppMemoryPercentAvg30Day__c": null
          },
          {
              "expectedResult": {
                  "status": "INAPPLICABLE",
                  "conditionIndex": "699",
                  "conditionText": "extract('CA10__pausedDate__c').withinLastDays(30)",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2025-09-15T09:48:55Z"
              },
              "Id": "test5",
              "CA10__disappearanceTime__c": null,
              "CA10__skuName__c": "GP_S_Gen5",
              "CA10__satus__c": "Online",
              "CA10__kind__c": "vcore",
              "CA10__creationDate__c": "2019-07-19T17:20:08Z",
              "CA10__pausedDate__c": "2025-09-05T10:48:45Z",
              "CA10__monitorCpuPercentAvg30Day__c": 0,
              "CA10__monitorStoragePercentMax30Day__c": 0,
              "CA10__monitorDtuConsumptionPercentAvg30Day__c": null,
              "CA10__monitorAppMemoryPercentAvg30Day__c": 1
          },
          {
              "expectedResult": {
                  "status": "UNDETERMINED",
                  "conditionIndex": "799",
                  "conditionText": "extract('CA10__monitorCpuPercentAvg30Day__c').isEmpty() || extract('CA10__monitorStoragePercentMax30Day__c').isEmpty()",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2025-09-15T09:48:55Z"
              },
              "Id": "test6",
              "CA10__disappearanceTime__c": null,
              "CA10__skuName__c": "Basic",
              "CA10__satus__c": "Online",
              "CA10__kind__c": "vcore",
              "CA10__creationDate__c": "2019-12-12T02:20:52Z",
              "CA10__pausedDate__c": null,
              "CA10__monitorCpuPercentAvg30Day__c": null,
              "CA10__monitorStoragePercentMax30Day__c": 81,
              "CA10__monitorDtuConsumptionPercentAvg30Day__c": 1,
              "CA10__monitorAppMemoryPercentAvg30Day__c": null
          },
          {
              "expectedResult": {
                  "status": "INCOMPLIANT",
                  "conditionIndex": "899",
                  "conditionText": "extract('CA10__monitorDtuConsumptionPercentAvg30Day__c').isNotEmpty() && extract('CA10__monitorDtuConsumptionPercentAvg30Day__c') < number(20.0) && extract('CA10__monitorStoragePercentMax30Day__c') < number(10.0)",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2025-09-15T09:48:55Z"
              },
              "Id": "test7",
              "CA10__disappearanceTime__c": null,
              "CA10__skuName__c": "Basic",
              "CA10__satus__c": "Online",
              "CA10__kind__c": "vcore",
              "CA10__creationDate__c": "2021-10-20T14:33:20Z",
              "CA10__pausedDate__c": null,
              "CA10__monitorCpuPercentAvg30Day__c": 0,
              "CA10__monitorStoragePercentMax30Day__c": 2,
              "CA10__monitorDtuConsumptionPercentAvg30Day__c": 1,
              "CA10__monitorAppMemoryPercentAvg30Day__c": null
          },
          {
              "expectedResult": {
                  "status": "INCOMPLIANT",
                  "conditionIndex": "999",
                  "conditionText": "extract('CA10__monitorAppMemoryPercentAvg30Day__c').isNotEmpty() && extract('CA10__monitorAppMemoryPercentAvg30Day__c') < number(40.0) && extract('CA10__monitorCpuPercentAvg30Day__c') < number(20.0) && extract('CA10__monitorStoragePercentMax30Day__c') < number(10.0)",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2025-09-15T09:48:55Z"
              },
              "Id": "test8",
              "CA10__disappearanceTime__c": null,
              "CA10__skuName__c": "GP_S_Gen5",
              "CA10__satus__c": "Online",
              "CA10__kind__c": "vcore",
              "CA10__creationDate__c": "2025-07-22T09:30:54Z",
              "CA10__pausedDate__c": null,
              "CA10__monitorCpuPercentAvg30Day__c": 0,
              "CA10__monitorStoragePercentMax30Day__c": 0,
              "CA10__monitorDtuConsumptionPercentAvg30Day__c": null,
              "CA10__monitorAppMemoryPercentAvg30Day__c": 1
          },
          {
              "expectedResult": {
                  "status": "INCOMPLIANT",
                  "conditionIndex": "1099",
                  "conditionText": "extract('CA10__monitorDtuConsumptionPercentAvg30Day__c').isEmpty() && extract('CA10__monitorAppMemoryPercentAvg30Day__c').isEmpty() && extract('CA10__monitorCpuPercentAvg30Day__c') < number(20.0) && extract('CA10__monitorStoragePercentMax30Day__c') < number(10.0)",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2025-09-15T09:48:55Z"
              },
              "Id": "test9",
              "CA10__disappearanceTime__c": null,
              "CA10__skuName__c": "BC_Gen5",
              "CA10__satus__c": "Online",
              "CA10__kind__c": "vcore",
              "CA10__creationDate__c": "2018-11-06T18:38:09Z",
              "CA10__pausedDate__c": null,
              "CA10__monitorCpuPercentAvg30Day__c": 1,
              "CA10__monitorStoragePercentMax30Day__c": 4,
              "CA10__monitorDtuConsumptionPercentAvg30Day__c": null,
              "CA10__monitorAppMemoryPercentAvg30Day__c": null
          },
          {
              "expectedResult": {
                  "status": "COMPLIANT",
                  "conditionIndex": "1100",
                  "conditionText": "otherwise",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2025-09-15T09:48:55Z"
              },
              "Id": "test10",
              "CA10__disappearanceTime__c": null,
              "CA10__skuName__c": "BC_Gen5",
              "CA10__satus__c": "Online",
              "CA10__kind__c": "vcore",
              "CA10__creationDate__c": "2020-08-28T17:02:43Z",
              "CA10__pausedDate__c": null,
              "CA10__monitorCpuPercentAvg30Day__c": 1,
              "CA10__monitorStoragePercentMax30Day__c": 50,
              "CA10__monitorDtuConsumptionPercentAvg30Day__c": 50,
              "CA10__monitorAppMemoryPercentAvg30Day__c": null
          },
          {
              "expectedResult": {
                  "status": "INAPPLICABLE",
                  "conditionIndex": "199",
                  "conditionText": "extract('CA10__skuName__c') == 'ElasticPool'",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2025-09-15T09:48:55Z"
              },
              "Id": "test11",
              "CA10__disappearanceTime__c": null,
              "CA10__skuName__c": "ElasticPool",
              "CA10__satus__c": "Online",
              "CA10__kind__c": "vcore",
              "CA10__creationDate__c": "2023-04-04T07:54:57Z",
              "CA10__pausedDate__c": null,
              "CA10__monitorCpuPercentAvg30Day__c": null,
              "CA10__monitorStoragePercentMax30Day__c": 0,
              "CA10__monitorDtuConsumptionPercentAvg30Day__c": 0,
              "CA10__monitorAppMemoryPercentAvg30Day__c": null
          },
          {
              "expectedResult": {
                  "status": "INAPPLICABLE",
                  "conditionIndex": "299",
                  "conditionText": "extract('CA10__kind__c').contains('serverless')",
                  "runtimeError": null
              },
              "context": {
                  "snapshotTime": "2025-09-15T09:48:55Z"
              },
              "Id": "test12",
              "CA10__disappearanceTime__c": null,
              "CA10__skuName__c": "BC_Gen5",
              "CA10__kind__c": "serverless",
              "CA10__satus__c": "Online",
              "CA10__creationDate__c": "2023-04-04T07:54:57Z",
              "CA10__pausedDate__c": null,
              "CA10__monitorCpuPercentAvg30Day__c": null,
              "CA10__monitorStoragePercentMax30Day__c": 0,
              "CA10__monitorDtuConsumptionPercentAvg30Day__c": 0,
              "CA10__monitorAppMemoryPercentAvg30Day__c": null
          }
      ]
  - path: /types/CA10__CaAzureSqlDatabase__c/object.extracts.yaml
    md5Hash: B4BDC0B62AEF4B03FB276D037CE05688
    content: "---\nextracts:\n# Not Nullable. Can't have no access, retrieved via\
      \ Microsoft.Sql/servers/databases/read\n  - name: \"CA10__name__c\"\n    value:\
      \ \n      FIELD:\n        path: \"CA10__name__c\"\n        undeterminedIf:\n\
      \          isEmpty: \"Corrupted Data. Database Name cannot be empty.\"\n# Not\
      \ Nullable. Can't have no access, retrieved via Microsoft.Sql/servers/databases/read\n\
      \  - name: \"CA10__kind__c\"\n    value: \n      FIELD:\n        path: \"CA10__kind__c\"\
      \n        undeterminedIf:\n          isEmpty: \"Corrupted Data. Database Kind\
      \ cannot be empty.\"\n# Values: Enabled, Disabled. Not Nullable. \n  - name:\
      \ \"CA10__dataEncryption__c\"\n    value: \n      FIELD:\n        path: \"CA10__dataEncryption__c\"\
      \n        undeterminedIf:\n          noAccessDelegate:\n            path: \"\
      CA10__dataEncryption__c\"\n            currentStateMessage: \"Unable to determine\
      \ Transparent Data Encryption. Possible permission issue with Microsoft.Sql/servers/databases/transparentDataEncryption/read.\"\
      \n          isEmpty: \"SQL Database Transparent Data Encryption is not populated\
      \ yet.\"\n# Not nullable \n  - name: \"CA10__satus__c\"\n    value: \n     \
      \ FIELD:\n        path: \"CA10__satus__c\"\n# Nullable \n  - name: \"CA10__monitorCpuPercentAvg30Day__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__monitorCpuPercentAvg30Day__c\"\
      \n# Nullable \n  - name: \"CA10__monitorStoragePercentMax30Day__c\"\n    value:\
      \ \n      FIELD:\n        path: \"CA10__monitorStoragePercentMax30Day__c\"\n\
      # Nullable \n  - name: \"CA10__monitorDtuConsumptionPercentAvg30Day__c\"\n \
      \   value: \n      FIELD:\n        path: \"CA10__monitorDtuConsumptionPercentAvg30Day__c\"\
      \n# Nullable \n  - name: \"CA10__monitorAppMemoryPercentAvg30Day__c\"\n    value:\
      \ \n      FIELD:\n        path: \"CA10__monitorAppMemoryPercentAvg30Day__c\"\
      \n# Not Nullable \n  - name: \"CA10__creationDate__c\"\n    value: \n      FIELD:\n\
      \        path: \"CA10__creationDate__c\"\n# Nullable \n  - name: \"CA10__pausedDate__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__pausedDate__c\"\n# Not Nullable\
      \ \n  - name: \"CA10__skuName__c\"\n    value: \n      FIELD:\n        path:\
      \ \"CA10__skuName__c\"\n# Text. Not Nullable \n  - name: \"CA10__locationName__c\"\
      \n    value: \n      FIELD:\n        path: \"CA10__locationName__c\"\n"
script: |-
  CREATE TEMP FUNCTION mock_ExpectedResult()
  RETURNS ARRAY<STRUCT<
          Id STRING,
          expectedResult STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, runtimeError STRING>
      >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "Id" : "test1",
    "expectedResult" : {
      "status" : "DISAPPEARED",
      "conditionIndex" : "99",
      "conditionText" : "isDisappeared(CA10__disappearanceTime__c)",
      "runtimeError" : null
    }
  }, {
    "Id" : "test2",
    "expectedResult" : {
      "status" : "INAPPLICABLE",
      "conditionIndex" : "399",
      "conditionText" : "extract('CA10__kind__c').contains('system')",
      "runtimeError" : null
    }
  }, {
    "Id" : "test3",
    "expectedResult" : {
      "status" : "INAPPLICABLE",
      "conditionIndex" : "499",
      "conditionText" : "extract('CA10__satus__c') != 'Online'",
      "runtimeError" : null
    }
  }, {
    "Id" : "test4",
    "expectedResult" : {
      "status" : "INAPPLICABLE",
      "conditionIndex" : "599",
      "conditionText" : "extract('CA10__creationDate__c').withinLastDays(30)",
      "runtimeError" : null
    }
  }, {
    "Id" : "test5",
    "expectedResult" : {
      "status" : "INAPPLICABLE",
      "conditionIndex" : "699",
      "conditionText" : "extract('CA10__pausedDate__c').withinLastDays(30)",
      "runtimeError" : null
    }
  }, {
    "Id" : "test6",
    "expectedResult" : {
      "status" : "UNDETERMINED",
      "conditionIndex" : "799",
      "conditionText" : "extract('CA10__monitorCpuPercentAvg30Day__c').isEmpty() || extract('CA10__monitorStoragePercentMax30Day__c').isEmpty()",
      "runtimeError" : null
    }
  }, {
    "Id" : "test7",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "899",
      "conditionText" : "extract('CA10__monitorDtuConsumptionPercentAvg30Day__c').isNotEmpty() && extract('CA10__monitorDtuConsumptionPercentAvg30Day__c') < number(20.0) && extract('CA10__monitorStoragePercentMax30Day__c') < number(10.0)",
      "runtimeError" : null
    }
  }, {
    "Id" : "test8",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "999",
      "conditionText" : "extract('CA10__monitorAppMemoryPercentAvg30Day__c').isNotEmpty() && extract('CA10__monitorAppMemoryPercentAvg30Day__c') < number(40.0) && extract('CA10__monitorCpuPercentAvg30Day__c') < number(20.0) && extract('CA10__monitorStoragePercentMax30Day__c') < number(10.0)",
      "runtimeError" : null
    }
  }, {
    "Id" : "test9",
    "expectedResult" : {
      "status" : "INCOMPLIANT",
      "conditionIndex" : "1099",
      "conditionText" : "extract('CA10__monitorDtuConsumptionPercentAvg30Day__c').isEmpty() && extract('CA10__monitorAppMemoryPercentAvg30Day__c').isEmpty() && extract('CA10__monitorCpuPercentAvg30Day__c') < number(20.0) && extract('CA10__monitorStoragePercentMax30Day__c') < number(10.0)",
      "runtimeError" : null
    }
  }, {
    "Id" : "test10",
    "expectedResult" : {
      "status" : "COMPLIANT",
      "conditionIndex" : "1100",
      "conditionText" : "otherwise",
      "runtimeError" : null
    }
  }, {
    "Id" : "test11",
    "expectedResult" : {
      "status" : "INAPPLICABLE",
      "conditionIndex" : "199",
      "conditionText" : "extract('CA10__skuName__c') == 'ElasticPool'",
      "runtimeError" : null
    }
  }, {
    "Id" : "test12",
    "expectedResult" : {
      "status" : "INAPPLICABLE",
      "conditionIndex" : "299",
      "conditionText" : "extract('CA10__kind__c').contains('serverless')",
      "runtimeError" : null
    }
  } ];
  """;

  CREATE TEMP FUNCTION mock_CA10__CaAzureSqlDatabase__c()
  RETURNS ARRAY<STRUCT<
      Id STRING,
      CA10__disappearanceTime__c TIMESTAMP,
      CA10__skuName__c STRING,
      CA10__kind__c STRING,
      CA10__satus__c STRING,
      CA10__creationDate__c TIMESTAMP,
      CA10__pausedDate__c TIMESTAMP,
      CA10__monitorCpuPercentAvg30Day__c FLOAT64,
      CA10__monitorStoragePercentMax30Day__c FLOAT64,
      CA10__monitorDtuConsumptionPercentAvg30Day__c FLOAT64,
      CA10__monitorAppMemoryPercentAvg30Day__c FLOAT64,
      context STRUCT<
          snapshotTime TIMESTAMP
      >
  >>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
    return [ {
    "context" : {
      "snapshotTime" : new Date("2025-09-15T09:48:55Z")
    },
    "Id" : "test1",
    "CA10__disappearanceTime__c" : new Date("2025-09-12T23:10:53Z"),
    "CA10__skuName__c" : "ElasticPool",
    "CA10__kind__c" : "vcore",
    "CA10__satus__c" : "Online",
    "CA10__creationDate__c" : new Date("2023-04-04T07:54:57Z"),
    "CA10__monitorCpuPercentAvg30Day__c" : null,
    "CA10__monitorStoragePercentMax30Day__c" : 0,
    "CA10__monitorDtuConsumptionPercentAvg30Day__c" : 0,
    "CA10__monitorAppMemoryPercentAvg30Day__c" : null
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-15T09:48:55Z")
    },
    "Id" : "test2",
    "CA10__skuName__c" : "System",
    "CA10__kind__c" : "vcore,system",
    "CA10__satus__c" : "Online",
    "CA10__creationDate__c" : new Date("2019-02-20T09:20:28Z"),
    "CA10__monitorCpuPercentAvg30Day__c" : null,
    "CA10__monitorStoragePercentMax30Day__c" : null,
    "CA10__monitorDtuConsumptionPercentAvg30Day__c" : null,
    "CA10__monitorAppMemoryPercentAvg30Day__c" : null
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-15T09:48:55Z")
    },
    "Id" : "test3",
    "CA10__skuName__c" : "GP_S_Gen5",
    "CA10__kind__c" : "vcore",
    "CA10__satus__c" : "Paused",
    "CA10__creationDate__c" : new Date("2020-05-26T23:17:04Z"),
    "CA10__pausedDate__c" : new Date("2025-08-05T04:32:40Z"),
    "CA10__monitorCpuPercentAvg30Day__c" : null,
    "CA10__monitorStoragePercentMax30Day__c" : null,
    "CA10__monitorDtuConsumptionPercentAvg30Day__c" : null,
    "CA10__monitorAppMemoryPercentAvg30Day__c" : null
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-15T09:48:55Z")
    },
    "Id" : "test4",
    "CA10__skuName__c" : "Basic",
    "CA10__kind__c" : "vcore",
    "CA10__satus__c" : "Online",
    "CA10__creationDate__c" : new Date("2025-08-19T03:48:33Z"),
    "CA10__monitorCpuPercentAvg30Day__c" : null,
    "CA10__monitorStoragePercentMax30Day__c" : 1,
    "CA10__monitorDtuConsumptionPercentAvg30Day__c" : 1,
    "CA10__monitorAppMemoryPercentAvg30Day__c" : null
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-15T09:48:55Z")
    },
    "Id" : "test5",
    "CA10__skuName__c" : "GP_S_Gen5",
    "CA10__kind__c" : "vcore",
    "CA10__satus__c" : "Online",
    "CA10__creationDate__c" : new Date("2019-07-19T17:20:08Z"),
    "CA10__pausedDate__c" : new Date("2025-09-05T10:48:45Z"),
    "CA10__monitorCpuPercentAvg30Day__c" : 0,
    "CA10__monitorStoragePercentMax30Day__c" : 0,
    "CA10__monitorDtuConsumptionPercentAvg30Day__c" : null,
    "CA10__monitorAppMemoryPercentAvg30Day__c" : 1
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-15T09:48:55Z")
    },
    "Id" : "test6",
    "CA10__skuName__c" : "Basic",
    "CA10__kind__c" : "vcore",
    "CA10__satus__c" : "Online",
    "CA10__creationDate__c" : new Date("2019-12-12T02:20:52Z"),
    "CA10__monitorCpuPercentAvg30Day__c" : null,
    "CA10__monitorStoragePercentMax30Day__c" : 81,
    "CA10__monitorDtuConsumptionPercentAvg30Day__c" : 1,
    "CA10__monitorAppMemoryPercentAvg30Day__c" : null
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-15T09:48:55Z")
    },
    "Id" : "test7",
    "CA10__skuName__c" : "Basic",
    "CA10__kind__c" : "vcore",
    "CA10__satus__c" : "Online",
    "CA10__creationDate__c" : new Date("2021-10-20T14:33:20Z"),
    "CA10__monitorCpuPercentAvg30Day__c" : 0,
    "CA10__monitorStoragePercentMax30Day__c" : 2,
    "CA10__monitorDtuConsumptionPercentAvg30Day__c" : 1,
    "CA10__monitorAppMemoryPercentAvg30Day__c" : null
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-15T09:48:55Z")
    },
    "Id" : "test8",
    "CA10__skuName__c" : "GP_S_Gen5",
    "CA10__kind__c" : "vcore",
    "CA10__satus__c" : "Online",
    "CA10__creationDate__c" : new Date("2025-07-22T09:30:54Z"),
    "CA10__monitorCpuPercentAvg30Day__c" : 0,
    "CA10__monitorStoragePercentMax30Day__c" : 0,
    "CA10__monitorDtuConsumptionPercentAvg30Day__c" : null,
    "CA10__monitorAppMemoryPercentAvg30Day__c" : 1
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-15T09:48:55Z")
    },
    "Id" : "test9",
    "CA10__skuName__c" : "BC_Gen5",
    "CA10__kind__c" : "vcore",
    "CA10__satus__c" : "Online",
    "CA10__creationDate__c" : new Date("2018-11-06T18:38:09Z"),
    "CA10__monitorCpuPercentAvg30Day__c" : 1,
    "CA10__monitorStoragePercentMax30Day__c" : 4,
    "CA10__monitorDtuConsumptionPercentAvg30Day__c" : null,
    "CA10__monitorAppMemoryPercentAvg30Day__c" : null
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-15T09:48:55Z")
    },
    "Id" : "test10",
    "CA10__skuName__c" : "BC_Gen5",
    "CA10__kind__c" : "vcore",
    "CA10__satus__c" : "Online",
    "CA10__creationDate__c" : new Date("2020-08-28T17:02:43Z"),
    "CA10__monitorCpuPercentAvg30Day__c" : 1,
    "CA10__monitorStoragePercentMax30Day__c" : 50,
    "CA10__monitorDtuConsumptionPercentAvg30Day__c" : 50,
    "CA10__monitorAppMemoryPercentAvg30Day__c" : null
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-15T09:48:55Z")
    },
    "Id" : "test11",
    "CA10__skuName__c" : "ElasticPool",
    "CA10__kind__c" : "vcore",
    "CA10__satus__c" : "Online",
    "CA10__creationDate__c" : new Date("2023-04-04T07:54:57Z"),
    "CA10__monitorCpuPercentAvg30Day__c" : null,
    "CA10__monitorStoragePercentMax30Day__c" : 0,
    "CA10__monitorDtuConsumptionPercentAvg30Day__c" : 0,
    "CA10__monitorAppMemoryPercentAvg30Day__c" : null
  }, {
    "context" : {
      "snapshotTime" : new Date("2025-09-15T09:48:55Z")
    },
    "Id" : "test12",
    "CA10__skuName__c" : "BC_Gen5",
    "CA10__kind__c" : "serverless",
    "CA10__satus__c" : "Online",
    "CA10__creationDate__c" : new Date("2023-04-04T07:54:57Z"),
    "CA10__monitorCpuPercentAvg30Day__c" : null,
    "CA10__monitorStoragePercentMax30Day__c" : 0,
    "CA10__monitorDtuConsumptionPercentAvg30Day__c" : 0,
    "CA10__monitorAppMemoryPercentAvg30Day__c" : null
  } ];
  """;

  CREATE TEMP FUNCTION process_CA10__CaAzureSqlDatabase__c(
      obj STRUCT<
          Id STRING,
          CA10__disappearanceTime__c TIMESTAMP,
          CA10__skuName__c STRING,
          CA10__kind__c STRING,
          CA10__satus__c STRING,
          CA10__creationDate__c TIMESTAMP,
          CA10__pausedDate__c TIMESTAMP,
          CA10__monitorCpuPercentAvg30Day__c FLOAT64,
          CA10__monitorStoragePercentMax30Day__c FLOAT64,
          CA10__monitorDtuConsumptionPercentAvg30Day__c FLOAT64,
          CA10__monitorAppMemoryPercentAvg30Day__c FLOAT64
      >,
      snapshotTime TIMESTAMP
  )
  RETURNS STRUCT<status STRING, conditionIndex DECIMAL, conditionText STRING, currentStateMessage STRING, currentStateReferences STRING, remediation STRING, runtimeError STRING>
  DETERMINISTIC
  LANGUAGE js
  AS r"""
      var TextLib = new function () {
          this.normalize = function(arg) {
              return arg == null ? '' : arg.replace(/\s+/g, ' ').trim().toLowerCase();
          };
          this.isEmpty = function(arg) {
              return this.normalize(arg) == '';
          };
          this.isNotEmpty = function(arg) {
              return this.normalize(arg) != '';
          };
          this.equal = function(left, right) {
              return this.normalize(left) == this.normalize(right);
          };
          this.notEqual = function(left, right) {
              return this.normalize(left) != this.normalize(right);
          };
          this.startsWith = function(arg, substring) {
              return this.normalize(arg).startsWith(this.normalize(substring));
          };
          this.endsWith = function(arg, substring) {
              return this.normalize(arg).endsWith(this.normalize(substring));
          };
          this.contains = function(arg, substring) {
              return this.normalize(arg).includes(this.normalize(substring));
          };
          this.containsAll = function(arg, substrings) {
              if (substrings == null || substrings.length === 0) return false;
              let normalizedArg = this.normalize(arg);
              return substrings.every(sub => normalizedArg.includes(this.normalize(sub)));
          };
          this.containsAny = function(arg, substrings) {
              if (substrings == null || substrings.length === 0) return false;
              let normalizedArg = this.normalize(arg);
              return substrings.some(sub => normalizedArg.includes(this.normalize(sub)));
          };
      }();
      var todayMinus30Day = new Date(snapshotTime.toISOString().substr(0,10)+'T00:00:00.000Z').getTime() + (-30 * 86400000);
      var todayPlus1Day = new Date(snapshotTime.toISOString().substr(0,10)+'T00:00:00.000Z').getTime() + (1 * 86400000);
      var IsEmptyLib = new function () {
          this.simpleIsEmpty = function(arg) {
              return arg == null;
          };
          this.simpleIsNotEmpty = function(arg) {
              return arg != null;
          };
      }();
      var references1 = [];
      // condition[0], conditionIndex:[0..99]
      references1.push('Deleted From Azure [CA10__disappearanceTime__c]: ' + obj.CA10__disappearanceTime__c);
      if (obj.CA10__disappearanceTime__c != null) {
          return {status: 'DISAPPEARED', conditionIndex: 99, conditionText: "isDisappeared(CA10__disappearanceTime__c)", currentStateMessage: "Object is deleted in the source", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[1], conditionIndex:[100..199]
      function extract3() { if (!this.out) { this.out = obj.CA10__skuName__c; } return this.out; };
      references1.push('SKU: Name [obj.CA10__skuName__c]: ' + obj.CA10__skuName__c);
      if (TextLib.equal(extract3.call(extract3), 'ElasticPool')) {
          return {status: 'INAPPLICABLE', conditionIndex: 199, conditionText: "extract('CA10__skuName__c') == 'ElasticPool'", currentStateMessage: "This database belongs to an Elastic Pool.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[2], conditionIndex:[200..299]
      function fieldChecked7() {
          if (TextLib.isEmpty(obj.CA10__kind__c)) {
              throw new Error("UNDETERMINED condition:201", {cause: {status: 'UNDETERMINED', conditionIndex: 201, conditionText: "CA10__kind__c.isEmpty()", currentStateMessage: "Corrupted Data. Database Kind cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10__kind__c;
      }
      function extract6() { if (!this.out) { this.out = fieldChecked7(); } return this.out; };
      references1.push('Kind [obj.CA10__kind__c]: ' + obj.CA10__kind__c);
      try {
          if (TextLib.contains(extract6.call(extract6), 'serverless')) {
              return {status: 'INAPPLICABLE', conditionIndex: 299, conditionText: "extract('CA10__kind__c').contains('serverless')", currentStateMessage: "This is a serverless database.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
          }
      } catch (err) {
          if (err.cause && err.cause.status) { return err.cause; } else { throw err; }
      }
      // condition[3], conditionIndex:[300..399]
      function fieldChecked10() {
          if (TextLib.isEmpty(obj.CA10__kind__c)) {
              throw new Error("UNDETERMINED condition:301", {cause: {status: 'UNDETERMINED', conditionIndex: 301, conditionText: "CA10__kind__c.isEmpty()", currentStateMessage: "Corrupted Data. Database Kind cannot be empty.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null}});
          }
          return obj.CA10__kind__c;
      }
      function extract9() { if (!this.out) { this.out = fieldChecked10(); } return this.out; };
      try {
          if (TextLib.contains(extract9.call(extract9), 'system')) {
              return {status: 'INAPPLICABLE', conditionIndex: 399, conditionText: "extract('CA10__kind__c').contains('system')", currentStateMessage: "This is a master database.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
          }
      } catch (err) {
          if (err.cause && err.cause.status) { return err.cause; } else { throw err; }
      }
      // condition[4], conditionIndex:[400..499]
      function extract12() { if (!this.out) { this.out = obj.CA10__satus__c; } return this.out; };
      references1.push('Status [obj.CA10__satus__c]: ' + obj.CA10__satus__c);
      if (TextLib.notEqual(extract12.call(extract12), 'Online')) {
          return {status: 'INAPPLICABLE', conditionIndex: 499, conditionText: "extract('CA10__satus__c') != 'Online'", currentStateMessage: "The database is not online.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[5], conditionIndex:[500..599]
      function extract15() { if (!this.out) { this.out = obj.CA10__creationDate__c; } return this.out; };
      references1.push('Creation Date [obj.CA10__creationDate__c]: ' + obj.CA10__creationDate__c);
      if (extract15.call(extract15) != null && extract15.call(extract15).getTime() >= todayMinus30Day && extract15.call(extract15).getTime() < todayPlus1Day) {
          return {status: 'INAPPLICABLE', conditionIndex: 599, conditionText: "extract('CA10__creationDate__c').withinLastDays(30)", currentStateMessage: "The database was created in the last 30 days.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[6], conditionIndex:[600..699]
      function extract19() { if (!this.out) { this.out = obj.CA10__pausedDate__c; } return this.out; };
      references1.push('Paused Date [obj.CA10__pausedDate__c]: ' + obj.CA10__pausedDate__c);
      if (extract19.call(extract19) != null && extract19.call(extract19).getTime() >= todayMinus30Day && extract19.call(extract19).getTime() < todayPlus1Day) {
          return {status: 'INAPPLICABLE', conditionIndex: 699, conditionText: "extract('CA10__pausedDate__c').withinLastDays(30)", currentStateMessage: "The database was paused in the last 30 days.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[7], conditionIndex:[700..799]
      function extract23() { if (!this.out) { this.out = obj.CA10__monitorCpuPercentAvg30Day__c; } return this.out; };
      function extract26() { if (!this.out) { this.out = obj.CA10__monitorStoragePercentMax30Day__c; } return this.out; };
      references1.push('Monitor: CPU Percent, 30-Day [obj.CA10__monitorCpuPercentAvg30Day__c]: ' + obj.CA10__monitorCpuPercentAvg30Day__c);
      references1.push('Monitor: Storage Percent, 30-Day [obj.CA10__monitorStoragePercentMax30Day__c]: ' + obj.CA10__monitorStoragePercentMax30Day__c);
      if (IsEmptyLib.simpleIsEmpty(extract23.call(extract23)) || IsEmptyLib.simpleIsEmpty(extract26.call(extract26))) {
          return {status: 'UNDETERMINED', conditionIndex: 799, conditionText: "extract('CA10__monitorCpuPercentAvg30Day__c').isEmpty() || extract('CA10__monitorStoragePercentMax30Day__c').isEmpty()", currentStateMessage: "There is not enough data in the CMDB to identify if the database is underutilized.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
      }
      // condition[8], conditionIndex:[800..899]
      function extract29() { if (!this.out) { this.out = obj.CA10__monitorDtuConsumptionPercentAvg30Day__c; } return this.out; };
      function extract35() { if (!this.out) { this.out = obj.CA10__monitorStoragePercentMax30Day__c; } return this.out; };
      references1.push('Monitor: DTU Consumption Percent, 30-Day [obj.CA10__monitorDtuConsumptionPercentAvg30Day__c]: ' + obj.CA10__monitorDtuConsumptionPercentAvg30Day__c);
      if (IsEmptyLib.simpleIsNotEmpty(extract29.call(extract29)) && (extract29.call(extract29) != null && 20.0 != null && extract29.call(extract29) < 20.0) && (extract35.call(extract35) != null && 10.0 != null && extract35.call(extract35) < 10.0)) {
          return {status: 'INCOMPLIANT', conditionIndex: 899, conditionText: "extract('CA10__monitorDtuConsumptionPercentAvg30Day__c').isNotEmpty() && extract('CA10__monitorDtuConsumptionPercentAvg30Day__c') < number(20.0) && extract('CA10__monitorStoragePercentMax30Day__c') < number(10.0)", currentStateMessage: "The database DTU consumption is less than 20% and storage utilization is less than 10%.", currentStateReferences: references1.join('\n'), remediation: "Consider rightsizing the database.", runtimeError: null};
      }
      // condition[9], conditionIndex:[900..999]
      function extract38() { if (!this.out) { this.out = obj.CA10__monitorAppMemoryPercentAvg30Day__c; } return this.out; };
      function extract44() { if (!this.out) { this.out = obj.CA10__monitorCpuPercentAvg30Day__c; } return this.out; };
      function extract48() { if (!this.out) { this.out = obj.CA10__monitorStoragePercentMax30Day__c; } return this.out; };
      references1.push('Monitor: App Memory Percent, 30-Day [obj.CA10__monitorAppMemoryPercentAvg30Day__c]: ' + obj.CA10__monitorAppMemoryPercentAvg30Day__c);
      if (IsEmptyLib.simpleIsNotEmpty(extract38.call(extract38)) && (extract38.call(extract38) != null && 40.0 != null && extract38.call(extract38) < 40.0) && (extract44.call(extract44) != null && 20.0 != null && extract44.call(extract44) < 20.0) && (extract48.call(extract48) != null && 10.0 != null && extract48.call(extract48) < 10.0)) {
          return {status: 'INCOMPLIANT', conditionIndex: 999, conditionText: "extract('CA10__monitorAppMemoryPercentAvg30Day__c').isNotEmpty() && extract('CA10__monitorAppMemoryPercentAvg30Day__c') < number(40.0) && extract('CA10__monitorCpuPercentAvg30Day__c') < number(20.0) && extract('CA10__monitorStoragePercentMax30Day__c') < number(10.0)", currentStateMessage: "The database CPU utilization is less than 20%, App Memory utilization < 40%, and storage utilization is less than 10%.", currentStateReferences: references1.join('\n'), remediation: "Consider rightsizing the database.", runtimeError: null};
      }
      // condition[10], conditionIndex:[1000..1099]
      function extract51() { if (!this.out) { this.out = obj.CA10__monitorDtuConsumptionPercentAvg30Day__c; } return this.out; };
      function extract54() { if (!this.out) { this.out = obj.CA10__monitorAppMemoryPercentAvg30Day__c; } return this.out; };
      function extract58() { if (!this.out) { this.out = obj.CA10__monitorCpuPercentAvg30Day__c; } return this.out; };
      function extract62() { if (!this.out) { this.out = obj.CA10__monitorStoragePercentMax30Day__c; } return this.out; };
      if (IsEmptyLib.simpleIsEmpty(extract51.call(extract51)) && IsEmptyLib.simpleIsEmpty(extract54.call(extract54)) && (extract58.call(extract58) != null && 20.0 != null && extract58.call(extract58) < 20.0) && (extract62.call(extract62) != null && 10.0 != null && extract62.call(extract62) < 10.0)) {
          return {status: 'INCOMPLIANT', conditionIndex: 1099, conditionText: "extract('CA10__monitorDtuConsumptionPercentAvg30Day__c').isEmpty() && extract('CA10__monitorAppMemoryPercentAvg30Day__c').isEmpty() && extract('CA10__monitorCpuPercentAvg30Day__c') < number(20.0) && extract('CA10__monitorStoragePercentMax30Day__c') < number(10.0)", currentStateMessage: "The database CPU is less than 20% and storage utilization is less than 10%.", currentStateReferences: references1.join('\n'), remediation: "Consider rightsizing the database.", runtimeError: null};
      }
      return {status: 'COMPLIANT', conditionIndex: 1100, conditionText: "otherwise", currentStateMessage: "The database is not underutilized.", currentStateReferences: references1.join('\n'), remediation: null, runtimeError: null};
  """;


  SELECT
    expectedResult.Id as Id,
    IF (
      IFNULL(expectedResult.expectedResult.status, '') = IFNULL(sObject.result.status, '')
      AND IFNULL(expectedResult.expectedResult.conditionIndex, -1) = IFNULL(sObject.result.conditionIndex, -1)
      AND IFNULL(expectedResult.expectedResult.conditionText, '') = IFNULL(sObject.result.conditionText, '')
      AND IFNULL(expectedResult.expectedResult.runtimeError, '') = IFNULL(sObject.result.runtimeError, ''),
      "MATCH",
      "FAIL"
    ) as match,
    expectedResult.expectedResult.status as expectedStatus, sObject.result.status as actualStatus,
    expectedResult.expectedResult.conditionIndex as expectedConditionIndex, sObject.result.conditionIndex as actualConditionIndex,
    expectedResult.expectedResult.conditionText as expectedConditionText, sObject.result.conditionText as actualConditionText,
    expectedResult.expectedResult.runtimeError as expectedRuntimeError, sObject.result.runtimeError as actualRuntimeError
  FROM UNNEST(mock_ExpectedResult()) expectedResult
  LEFT JOIN (
      SELECT
          sObject.Id AS Id,
          sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
          sObject.CA10__skuName__c AS CA10__skuName__c,
          sObject.CA10__kind__c AS CA10__kind__c,
          sObject.CA10__satus__c AS CA10__satus__c,
          sObject.CA10__creationDate__c AS CA10__creationDate__c,
          sObject.CA10__pausedDate__c AS CA10__pausedDate__c,
          sObject.CA10__monitorCpuPercentAvg30Day__c AS CA10__monitorCpuPercentAvg30Day__c,
          sObject.CA10__monitorStoragePercentMax30Day__c AS CA10__monitorStoragePercentMax30Day__c,
          sObject.CA10__monitorDtuConsumptionPercentAvg30Day__c AS CA10__monitorDtuConsumptionPercentAvg30Day__c,
          sObject.CA10__monitorAppMemoryPercentAvg30Day__c AS CA10__monitorAppMemoryPercentAvg30Day__c,
          process_CA10__CaAzureSqlDatabase__c(
              STRUCT(
                  sObject.Id AS Id,
                  sObject.CA10__disappearanceTime__c AS CA10__disappearanceTime__c,
                  sObject.CA10__skuName__c AS CA10__skuName__c,
                  sObject.CA10__kind__c AS CA10__kind__c,
                  sObject.CA10__satus__c AS CA10__satus__c,
                  sObject.CA10__creationDate__c AS CA10__creationDate__c,
                  sObject.CA10__pausedDate__c AS CA10__pausedDate__c,
                  sObject.CA10__monitorCpuPercentAvg30Day__c AS CA10__monitorCpuPercentAvg30Day__c,
                  sObject.CA10__monitorStoragePercentMax30Day__c AS CA10__monitorStoragePercentMax30Day__c,
                  sObject.CA10__monitorDtuConsumptionPercentAvg30Day__c AS CA10__monitorDtuConsumptionPercentAvg30Day__c,
                  sObject.CA10__monitorAppMemoryPercentAvg30Day__c AS CA10__monitorAppMemoryPercentAvg30Day__c
              ),
              sObject.context.snapshotTime
          ) as result
      FROM UNNEST(mock_CA10__CaAzureSqlDatabase__c()) AS sObject
  ) sObject ON sObject.Id = expectedResult.Id;
