{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/power-bi/json-schema/power-bi-goals-rules-goal-status-rules-schema.json",
  "title": "Goals.Rules.GoalStatusRules",
  "description": "The request data to be used when defining or reporting rules for the status of a Power BI goal",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/power-bi-goalsstatusrules-preview-api-openapi.yml#/components/schemas/Goals.Rules.GoalStatusRules",
  "properties": {
    "rules": {
      "description": "The list of rules",
      "type": "array",
      "items": {
        "$ref": "#/$defs/Goals.Rules.Rule_1OfInt32"
      }
    },
    "defaultOutput": {
      "description": "The status ID when no rule matches\n\n| ID | Description |\n|-|-|\n| 0 | Not started |\n| 1 | On track |\n| 2 | At risk |\n| 3 | Behind |\n| 4 | Overdue |\n| 5 | Completed |",
      "type": "integer",
      "format": "int32"
    },
    "scorecardObjectId": {
      "description": "The scorecard ID",
      "type": "string"
    },
    "goalObjectId": {
      "description": "The goal ID",
      "type": "string"
    },
    "lastModifiedTime": {
      "description": "The UTC time at last modification",
      "type": "string",
      "format": "date-time"
    }
  },
  "$defs": {
    "Goals.Rules.FieldComparison": {
      "description": "A field comparison specification for Power BI goal status rule",
      "properties": {
        "field": {
          "description": "The name of the field, such as `Timestamp`, `Value`, or `Change`.",
          "type": "string"
        },
        "operator": {
          "description": "The comparison operator",
          "type": "string",
          "enum": [
            "Equal",
            "GreaterThan",
            "GreaterThanOrEqual",
            "LessThan",
            "LessThanOrEqual"
          ],
          "x-ms-enum": {
            "name": "GoalRulesFieldComparisonKind",
            "modelAsExtensible": true,
            "modelAsString": false,
            "values": [
              {
                "value": "Equal",
                "description": "Are equal",
                "name": "Equal"
              },
              {
                "value": "GreaterThan",
                "description": "Is greater than",
                "name": "GreaterThan"
              },
              {
                "value": "GreaterThanOrEqual",
                "description": "Is greater than or equal",
                "name": "GreaterThanOrEqual"
              },
              {
                "value": "LessThan",
                "description": "Is less than",
                "name": "LessThan"
              },
              {
                "value": "LessThanOrEqual",
                "description": "Is less than or equal",
                "name": "LessThanOrEqual"
              }
            ]
          }
        },
        "value": {
          "description": "The rule value",
          "$ref": "#/$defs/Goals.Rules.RuleValue"
        }
      }
    },
    "Goals.Rules.PercentOf": {
      "description": "An entry defining a percentage of some target metric in a condition for Power BI goal status rule",
      "properties": {
        "field": {
          "description": "The field for which the percent value is computed",
          "type": "string"
        },
        "percent": {
          "description": "The percent value",
          "type": "number",
          "format": "double"
        }
      }
    },
    "Goals.Rules.RuleCondition": {
      "description": "A Power BI goal status rule",
      "properties": {
        "fieldComparison": {
          "description": "The field comparison definition when `expression` isn't defined",
          "$ref": "#/$defs/Goals.Rules.FieldComparison"
        },
        "expression": {
          "description": "The rule condition expression when `fieldComparison` isn't defined",
          "type": "string"
        }
      }
    },
    "Goals.Rules.RuleValue": {
      "description": "A specification for a condition in a Power BI goal status rule",
      "properties": {
        "percentOf": {
          "description": "An entry defining a percentage of some target metric",
          "$ref": "#/$defs/Goals.Rules.PercentOf"
        },
        "field": {
          "description": "The rule value",
          "type": "string"
        },
        "dateTime": {
          "description": "The rule value timestamp",
          "type": "string",
          "format": "date-time"
        },
        "number": {
          "description": "The rule value number",
          "type": "number",
          "format": "double"
        }
      }
    },
    "Goals.Rules.Rule_1OfInt32": {
      "description": "A status rule object for the Power BI goal",
      "properties": {
        "conditions": {
          "description": "The list of status rule conditions",
          "type": "array",
          "items": {
            "$ref": "#/$defs/Goals.Rules.RuleCondition"
          }
        },
        "output": {
          "description": "The status ID when conditions are met\n\n| ID | Description |\n|-|-|\n| 0 | Not started |\n| 1 | On track |\n| 2 | At risk |\n| 3 | Behind |\n| 4 | Overdue |\n| 5 | Completed |",
          "type": "integer",
          "format": "int32"
        }
      }
    }
  }
}