{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-connect/json-schema/amazon-connect-update-metric-content-request-schema.json",
  "title": "UpdateMetricContentRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-connect-content-api-openapi.yml#/components/schemas/UpdateMetricContentRequest",
  "type": "object",
  "properties": {
    "InstanceId": {
      "type": "string",
      "description": "The identifier of the Connect Customer instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance."
    },
    "MetricId": {
      "type": "string",
      "description": "The identifier of the metric to update. Adding the $SAVED qualifier will update the saved version of the metric. Adding $LATEST or omitting a qualifier will update the published version."
    },
    "MetricCalculation": {
      "$ref": "#/$defs/MetricCalculation"
    },
    "Unit": {
      "type": "string",
      "enum": [
        "INTEGER",
        "DOUBLE",
        "PERCENT",
        "SECONDS"
      ],
      "description": "The updated display unit for the metric."
    },
    "PositiveTrendIndicator": {
      "type": "string",
      "enum": [
        "POSITIVE",
        "NEGATIVE",
        "NEUTRAL"
      ],
      "description": "How an increase in the metric value should be interpreted. Valid values: POSITIVE, NEUTRAL, NEGATIVE."
    }
  },
  "required": [
    "InstanceId",
    "MetricId"
  ],
  "$defs": {
    "CalculationComponent": {
      "type": "object",
      "properties": {
        "Alias": {
          "type": "string",
          "description": "The alias used to reference this component in the calculation expression."
        },
        "MetricName": {
          "type": "string",
          "description": "The name of an AWS-managed metric used in this calculation component (for example, CONTACTS_HANDLED). Mutually exclusive with MetricId."
        },
        "MetricId": {
          "type": "string",
          "description": "The ARN of an AWS-managed metric used in this calculation component. Mutually exclusive with MetricName."
        },
        "MetricFilters": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MetricFilter"
          },
          "description": "The filters applied to the calculation component."
        }
      },
      "required": [
        "Alias"
      ]
    },
    "MetricCalculation": {
      "type": "object",
      "properties": {
        "CalculationComponents": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CalculationComponent"
          },
          "description": "The list of component metrics referenced in the calculation formula. Each component has an alias used in the formula expression."
        },
        "Calculation": {
          "type": "string",
          "description": "The formula expression that defines how the metric is calculated. Uses component aliases (for example, 100 * SUM(M1) / SUM(M2))."
        }
      },
      "required": [
        "CalculationComponents",
        "Calculation"
      ]
    },
    "MetricFilter": {
      "type": "object",
      "properties": {
        "MetricFilterKey": {
          "type": "string",
          "description": "The key identifying the field to filter on."
        },
        "Negate": {
          "type": "boolean",
          "description": "Specifies whether the filter condition is negated. When set to true, the filter excludes matching data instead of including it."
        },
        "NumberCondition": {
          "$ref": "#/$defs/MetricFilterNumberCondition"
        },
        "StringCondition": {
          "$ref": "#/$defs/MetricFilterStringCondition"
        },
        "BooleanCondition": {
          "$ref": "#/$defs/MetricFilterBooleanCondition"
        }
      },
      "required": [
        "MetricFilterKey"
      ]
    },
    "MetricFilterBooleanCondition": {
      "type": "object",
      "properties": {
        "Comparison": {
          "type": "string",
          "enum": [
            "IS_TRUE",
            "IS_FALSE"
          ],
          "description": "The comparison operator. Valid values: IS_TRUE (matches when the field is true) | IS_FALSE (matches when the field is false)."
        }
      },
      "required": [
        "Comparison"
      ]
    },
    "MetricFilterNumberCondition": {
      "type": "object",
      "properties": {
        "Comparison": {
          "type": "string",
          "enum": [
            "LESSER",
            "LESSER_OR_EQUAL",
            "GREATER",
            "GREATER_OR_EQUAL"
          ],
          "description": "The comparison operator. Valid values: LESSER (less than) | LESSER_OR_EQUAL (less than or equal to) | GREATER (greater than) | GREATER_OR_EQUAL (greater than or equal to)."
        },
        "Values": {
          "type": "array",
          "items": {
            "type": "number"
          },
          "description": "The numeric values to compare against."
        }
      },
      "required": [
        "Comparison",
        "Values"
      ]
    },
    "MetricFilterStringCondition": {
      "type": "object",
      "properties": {
        "Comparison": {
          "type": "string",
          "enum": [
            "MATCHES_ANY",
            "MATCHES_NONE"
          ],
          "description": "The comparison operator. Valid values: MATCHES_ANY (matches any of the specified values) | MATCHES_NONE (matches none of the specified values)."
        },
        "Values": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The string values to compare against."
        }
      },
      "required": [
        "Comparison",
        "Values"
      ]
    }
  }
}