{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/device42/main/json-schema/device42-app-group-calc-rule-get-schema.json",
  "title": "AppGroupCalcRuleGet",
  "x-generated": "2026-10-14",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/device42-openapi.yaml#/components/schemas/AppGroupCalcRuleGet",
  "allOf": [
    {
      "$ref": "#/$defs/AppGroupCalcRuleBase"
    },
    {
      "type": "object",
      "properties": {
        "is_system": {
          "type": "string",
          "enum": [
            "yes",
            "no"
          ],
          "description": "Whether the rule is a system rule or a custom rule."
        },
        "starting_point_devices": {
          "description": "JSON array of devices in the fixed starting point",
          "type": "array",
          "items": {
            "properties": {
              "device_id": {
                "type": "integer",
                "description": "ID of the device to use as a starting point"
              },
              "name": {
                "type": "string",
                "description": "Name of the device to use as a starting point"
              }
            }
          }
        },
        "starting_point_resources": {
          "description": "JSON array of resources in the fixed starting point",
          "type": "array",
          "items": {
            "properties": {
              "resource_id": {
                "type": "integer",
                "description": "ID of the resource to use as a starting point"
              },
              "name": {
                "type": "string",
                "description": "Name of the resource to use as a starting point"
              }
            }
          }
        },
        "starting_point_application_components": {
          "description": "JSON array of application components in the fixed starting point",
          "type": "array",
          "items": {
            "properties": {
              "application_component_id": {
                "type": "integer",
                "description": "ID of the application component to use as a starting point"
              },
              "name": {
                "type": "string",
                "description": "Name of the application component to use as a starting point"
              }
            }
          }
        },
        "starting_point_service_instances": {
          "description": "JSON array of service instances in the fixed starting point",
          "type": "array",
          "items": {
            "properties": {
              "service_detail_id": {
                "type": "integer",
                "description": "ID of the service instance to use as a starting point"
              },
              "service_display_name": {
                "type": "string",
                "description": "Display name of the service of service instance to use as a starting point"
              }
            }
          }
        },
        "last_processed": {
          "type": "string",
          "description": "Date and time the rule was last processed"
        },
        "processing_status": {
          "type": "string",
          "enum": [
            "Processing",
            "Completed",
            "Warnings",
            "Failed"
          ],
          "description": "Status of the rule processing"
        },
        "processing_logs": {
          "type": "string",
          "description": "Logs from the last processing of the rule"
        },
        "first_added": {
          "type": "string",
          "description": "Date and time the rule was added to the database"
        },
        "last_updated": {
          "type": "string",
          "description": "Date and time the rule record in the database was saved, regardless if any properties were changed or not"
        }
      }
    }
  ],
  "$defs": {
    "AppGroupCalcRuleBase": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer",
          "description": "ID of an existing Application Group Calculation Rule. Do not enter an ID if you are creating a new rule."
        },
        "name": {
          "type": "string",
          "description": "Name of the Application Group Calculation Rule. Either name or id is required."
        },
        "enabled": {
          "type": "string",
          "enum": [
            "yes",
            "no"
          ],
          "description": "Whether the rule is enabled or disabled."
        },
        "outcome": {
          "type": "string",
          "enum": [
            "Auto-Create",
            "Suggest"
          ],
          "description": "Whather the rule produces Application Groups or Application Group Suggestions when processing."
        },
        "starting_point_type": {
          "type": "string",
          "enum": [
            "Criteria",
            "Fixed"
          ],
          "description": "Whether the Application Groups start with a fixed starting point or a criteria based starting point."
        },
        "starting_point_criteria": {
          "description": "JSON array of starting point criteria",
          "type": "array",
          "items": {
            "properties": {
              "criteria": {
                "type": "string",
                "description": "Advanced query filtering as specified in list page for selected ci type."
              },
              "ci_type": {
                "type": "string",
                "enum": [
                  "application_component",
                  "device",
                  "resource",
                  "servicedetail"
                ],
                "description": "Type of CI to include - currently supporting application_component, device, resource, and servicedetail"
              },
              "required": {
                "type": "string",
                "enum": [
                  "yes",
                  "no"
                ],
                "description": "Whether the starting point is required for the rule."
              }
            }
          }
        },
        "group_by": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "How to group starting points for Application Groups when processing the rule. Available options depend on the CIs in the starting point."
        },
        "group_by_tags_like": {
          "type": "string",
          "description": "Tag pattern to group by. Use '%'' as a wildcard. For example, to group on tags like 'App-1', 'App-2', use 'App-%'. Either group_by or group_by_tags_like is required for criteria based starting points."
        },
        "application_group_calc_template": {
          "type": "string",
          "description": "Name of the Application Group Calculation Template to use for processing the rule. The default template is 'D42 Default Template'."
        },
        "application_group_calc_template_id": {
          "type": "integer",
          "description": "ID of the Application Group Calculation Template to use for processing the rule."
        },
        "levels_of_depth": {
          "type": "integer",
          "description": "Default levels of depth to display on Application Groups. Leave blank to fully expand."
        },
        "store_connection_metadata": {
          "type": "string",
          "enum": [
            "yes",
            "no"
          ],
          "description": "Whether to store and display connection metadata."
        }
      }
    }
  }
}