{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-cost-management/json-schema/microsoft-azure-cost-management-forecast-definition-schema.json",
  "title": "ForecastDefinition",
  "description": "The definition of a forecast.",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_superseded/microsoft-azure-cost-management-providers-api-openapi.yml#/components/schemas/ForecastDefinition",
  "type": "object",
  "properties": {
    "type": {
      "$ref": "#/$defs/ForecastType",
      "description": "The type of the forecast."
    },
    "timeframe": {
      "$ref": "#/$defs/ForecastTimeframe",
      "description": "The time frame for pulling data for the forecast. If custom, then a specific time period must be provided."
    },
    "timePeriod": {
      "$ref": "#/$defs/ForecastTimePeriod",
      "description": "Has time period for pulling data for the forecast."
    },
    "dataset": {
      "$ref": "#/$defs/ForecastDataset",
      "description": "Has definition for data in this forecast."
    },
    "includeActualCost": {
      "type": "boolean",
      "description": "A boolean determining if actualCost will be included."
    },
    "includeFreshPartialCost": {
      "type": "boolean",
      "description": "A boolean determining if FreshPartialCost will be included."
    }
  },
  "required": [
    "type",
    "timeframe",
    "dataset"
  ],
  "$defs": {
    "ForecastAggregation": {
      "type": "object",
      "description": "The aggregation expression to be used in the forecast.",
      "properties": {
        "name": {
          "$ref": "#/$defs/FunctionName",
          "description": "The name of the column to aggregate."
        },
        "function": {
          "$ref": "#/$defs/FunctionType",
          "description": "The name of the aggregation function to use."
        }
      },
      "required": [
        "name",
        "function"
      ]
    },
    "ForecastComparisonExpression": {
      "type": "object",
      "description": "The comparison expression to be used in the forecast.",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the column to use in comparison."
        },
        "operator": {
          "$ref": "#/$defs/ForecastOperatorType",
          "description": "The operator to use for comparison."
        },
        "values": {
          "type": "array",
          "description": "Array of values to use for comparison",
          "minItems": 1,
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "name",
        "operator",
        "values"
      ]
    },
    "ForecastDataset": {
      "type": "object",
      "description": "The definition of data present in the forecast.",
      "properties": {
        "granularity": {
          "$ref": "#/$defs/GranularityType",
          "description": "The granularity of rows in the forecast."
        },
        "configuration": {
          "$ref": "#/$defs/ForecastDatasetConfiguration",
          "description": "Has configuration information for the data in the export. The configuration will be ignored if aggregation and grouping are provided."
        },
        "aggregation": {
          "type": "object",
          "description": "Dictionary of aggregation expression to use in the forecast. The key of each item in the dictionary is the alias for the aggregated column. forecast can have up to 2 aggregation clauses.",
          "additionalProperties": {
            "$ref": "#/$defs/ForecastAggregation"
          }
        },
        "filter": {
          "$ref": "#/$defs/ForecastFilter",
          "description": "Has filter expression to use in the forecast."
        }
      },
      "required": [
        "aggregation"
      ]
    },
    "ForecastDatasetConfiguration": {
      "type": "object",
      "description": "The configuration of dataset in the forecast.",
      "properties": {
        "columns": {
          "type": "array",
          "description": "Array of column names to be included in the forecast. Any valid forecast column name is allowed. If not provided, then forecast includes all columns.",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "ForecastFilter": {
      "type": "object",
      "description": "The filter expression to be used in the export.",
      "properties": {
        "and": {
          "type": "array",
          "description": "The logical \"AND\" expression. Must have at least 2 items.",
          "minItems": 2,
          "items": {
            "$ref": "#/$defs/ForecastFilter"
          },
          "x-ms-identifiers": []
        },
        "or": {
          "type": "array",
          "description": "The logical \"OR\" expression. Must have at least 2 items.",
          "minItems": 2,
          "items": {
            "$ref": "#/$defs/ForecastFilter"
          },
          "x-ms-identifiers": []
        },
        "dimensions": {
          "$ref": "#/$defs/ForecastComparisonExpression",
          "description": "Has comparison expression for a dimension"
        },
        "tags": {
          "$ref": "#/$defs/ForecastComparisonExpression",
          "description": "Has comparison expression for a tag"
        }
      }
    },
    "ForecastOperatorType": {
      "type": "string",
      "description": "The operator to use for comparison.",
      "enum": [
        "In"
      ],
      "x-ms-enum": {
        "name": "ForecastOperatorType",
        "modelAsString": true,
        "values": [
          {
            "name": "In",
            "value": "In"
          }
        ]
      }
    },
    "ForecastTimePeriod": {
      "type": "object",
      "description": "Has time period for pulling data for the forecast.",
      "properties": {
        "from": {
          "type": "string",
          "format": "date-time",
          "description": "The start date to pull data from."
        },
        "to": {
          "type": "string",
          "format": "date-time",
          "description": "The end date to pull data to."
        }
      },
      "required": [
        "from",
        "to"
      ]
    },
    "ForecastTimeframe": {
      "type": "string",
      "description": "The time frame for pulling data for the forecast.",
      "enum": [
        "Custom"
      ],
      "x-ms-enum": {
        "name": "ForecastTimeframe",
        "modelAsString": true,
        "values": [
          {
            "name": "Custom",
            "value": "Custom"
          }
        ]
      }
    },
    "ForecastType": {
      "type": "string",
      "description": "The type of the forecast.",
      "enum": [
        "Usage",
        "ActualCost",
        "AmortizedCost"
      ],
      "x-ms-enum": {
        "name": "ForecastType",
        "modelAsString": true,
        "values": [
          {
            "name": "Usage",
            "value": "Usage"
          },
          {
            "name": "ActualCost",
            "value": "ActualCost"
          },
          {
            "name": "AmortizedCost",
            "value": "AmortizedCost"
          }
        ]
      }
    },
    "FunctionName": {
      "type": "string",
      "description": "The name of the column to aggregate.",
      "enum": [
        "PreTaxCostUSD",
        "Cost",
        "CostUSD",
        "PreTaxCost"
      ],
      "x-ms-enum": {
        "name": "FunctionName",
        "modelAsString": true,
        "values": [
          {
            "name": "PreTaxCostUSD",
            "value": "PreTaxCostUSD"
          },
          {
            "name": "Cost",
            "value": "Cost"
          },
          {
            "name": "CostUSD",
            "value": "CostUSD"
          },
          {
            "name": "PreTaxCost",
            "value": "PreTaxCost"
          }
        ]
      }
    },
    "FunctionType": {
      "type": "string",
      "description": "The name of the aggregation function to use.",
      "enum": [
        "Sum"
      ],
      "x-ms-enum": {
        "name": "FunctionType",
        "modelAsString": true,
        "values": [
          {
            "name": "Sum",
            "value": "Sum"
          }
        ]
      }
    },
    "GranularityType": {
      "type": "string",
      "description": "The granularity of rows in the export. Currently 'Daily' is supported for most cases.",
      "enum": [
        "Daily",
        "Monthly"
      ],
      "x-ms-enum": {
        "name": "GranularityType",
        "modelAsString": true,
        "values": [
          {
            "name": "Daily",
            "value": "Daily"
          },
          {
            "name": "Monthly",
            "value": "Monthly"
          }
        ]
      }
    }
  }
}