{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/azure-test-labs/json-schema/azure-test-labs-lab-cost-schema.json",
  "title": "LabCost",
  "description": "A cost item.",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/azure-test-labs-costs-api-openapi.yml#/components/schemas/LabCost",
  "allOf": [
    {
      "$ref": "#/$defs/Resource"
    }
  ],
  "properties": {
    "properties": {
      "$ref": "#/$defs/LabCostProperties",
      "description": "The properties of the resource.",
      "x-ms-client-flatten": true
    }
  },
  "required": [
    "properties"
  ],
  "type": "object",
  "$defs": {
    "CostThresholdProperties": {
      "description": "Properties of a cost threshold item.",
      "properties": {
        "displayOnChart": {
          "description": "Indicates whether this threshold will be displayed on cost charts.",
          "enum": [
            "Enabled",
            "Disabled"
          ],
          "type": "string",
          "x-ms-enum": {
            "modelAsString": true,
            "name": "CostThresholdStatus"
          }
        },
        "notificationSent": {
          "description": "Indicates the datetime when notifications were last sent for this threshold.",
          "type": "string"
        },
        "percentageThreshold": {
          "$ref": "#/$defs/PercentageCostThresholdProperties",
          "description": "The value of the percentage cost threshold."
        },
        "sendNotificationWhenExceeded": {
          "description": "Indicates whether notifications will be sent when this threshold is exceeded.",
          "enum": [
            "Enabled",
            "Disabled"
          ],
          "type": "string",
          "x-ms-enum": {
            "modelAsString": true,
            "name": "CostThresholdStatus"
          }
        },
        "thresholdId": {
          "description": "The ID of the cost threshold item.",
          "type": "string"
        }
      },
      "type": "object"
    },
    "LabCostDetailsProperties": {
      "description": "The properties of a lab cost item.",
      "properties": {
        "cost": {
          "description": "The cost component of the cost item.",
          "format": "double",
          "type": "number"
        },
        "costType": {
          "description": "The type of the cost.",
          "enum": [
            "Unavailable",
            "Reported",
            "Projected"
          ],
          "type": "string",
          "x-ms-enum": {
            "modelAsString": true,
            "name": "CostType"
          }
        },
        "date": {
          "description": "The date of the cost item.",
          "format": "date-time",
          "type": "string"
        }
      },
      "type": "object"
    },
    "LabCostProperties": {
      "description": "Properties of a cost item.",
      "properties": {
        "createdDate": {
          "description": "The creation date of the cost.",
          "format": "date-time",
          "type": "string"
        },
        "currencyCode": {
          "description": "The currency code of the cost.",
          "type": "string"
        },
        "endDateTime": {
          "description": "The end time of the cost data.",
          "format": "date-time",
          "type": "string"
        },
        "labCostDetails": {
          "description": "The lab cost details component of the cost data.",
          "items": {
            "$ref": "#/$defs/LabCostDetailsProperties"
          },
          "readOnly": true,
          "type": "array"
        },
        "labCostSummary": {
          "$ref": "#/$defs/LabCostSummaryProperties",
          "description": "The lab cost summary component of the cost data.",
          "readOnly": true
        },
        "provisioningState": {
          "description": "The provisioning status of the resource.",
          "readOnly": true,
          "type": "string"
        },
        "resourceCosts": {
          "description": "The resource cost component of the cost data.",
          "items": {
            "$ref": "#/$defs/LabResourceCostProperties"
          },
          "readOnly": true,
          "type": "array"
        },
        "startDateTime": {
          "description": "The start time of the cost data.",
          "format": "date-time",
          "type": "string"
        },
        "targetCost": {
          "$ref": "#/$defs/TargetCostProperties",
          "description": "The target cost properties"
        },
        "uniqueIdentifier": {
          "description": "The unique immutable identifier of a resource (Guid).",
          "readOnly": true,
          "type": "string"
        }
      },
      "type": "object"
    },
    "LabCostSummaryProperties": {
      "description": "The properties of the cost summary.",
      "properties": {
        "estimatedLabCost": {
          "description": "The cost component of the cost item.",
          "format": "double",
          "type": "number"
        }
      },
      "type": "object"
    },
    "LabResourceCostProperties": {
      "description": "The properties of a resource cost item.",
      "properties": {
        "externalResourceId": {
          "description": "The ID of the external resource",
          "type": "string"
        },
        "resourceCost": {
          "description": "The cost component of the resource cost item.",
          "format": "double",
          "type": "number"
        },
        "resourceId": {
          "description": "The ID of the resource",
          "type": "string"
        },
        "resourceOwner": {
          "description": "The owner of the resource (ex. janedoe@microsoft.com)",
          "type": "string"
        },
        "resourcePricingTier": {
          "description": "The category of the resource (ex. Premium_LRS, Standard_DS1)",
          "type": "string"
        },
        "resourceStatus": {
          "description": "The status of the resource (ex. Active)",
          "type": "string"
        },
        "resourceType": {
          "description": "The logical resource type (ex. virtualmachine, storageaccount)",
          "type": "string"
        },
        "resourceUId": {
          "description": "The unique identifier of the resource.",
          "type": "string"
        },
        "resourcename": {
          "description": "The name of the resource.",
          "type": "string"
        }
      },
      "type": "object"
    },
    "PercentageCostThresholdProperties": {
      "description": "Properties of a percentage cost threshold.",
      "properties": {
        "thresholdValue": {
          "description": "The cost threshold value.",
          "format": "double",
          "type": "number"
        }
      },
      "type": "object"
    },
    "Resource": {
      "description": "An Azure resource.",
      "properties": {
        "id": {
          "description": "The identifier of the resource.",
          "readOnly": true,
          "type": "string"
        },
        "location": {
          "description": "The location of the resource.",
          "type": "string"
        },
        "name": {
          "description": "The name of the resource.",
          "readOnly": true,
          "type": "string"
        },
        "tags": {
          "additionalProperties": {
            "type": "string"
          },
          "description": "The tags of the resource.",
          "type": "object"
        },
        "type": {
          "description": "The type of the resource.",
          "readOnly": true,
          "type": "string"
        }
      },
      "type": "object",
      "x-ms-azure-resource": true
    },
    "TargetCostProperties": {
      "description": "Properties of a cost target.",
      "properties": {
        "costThresholds": {
          "description": "Cost thresholds.",
          "items": {
            "$ref": "#/$defs/CostThresholdProperties"
          },
          "type": "array"
        },
        "cycleEndDateTime": {
          "description": "Reporting cycle end date.",
          "format": "date-time",
          "type": "string"
        },
        "cycleStartDateTime": {
          "description": "Reporting cycle start date.",
          "format": "date-time",
          "type": "string"
        },
        "cycleType": {
          "description": "Reporting cycle type.",
          "enum": [
            "CalendarMonth",
            "Custom"
          ],
          "type": "string",
          "x-ms-enum": {
            "modelAsString": true,
            "name": "ReportingCycleType"
          }
        },
        "status": {
          "description": "Target cost status",
          "enum": [
            "Enabled",
            "Disabled"
          ],
          "type": "string",
          "x-ms-enum": {
            "modelAsString": true,
            "name": "TargetCostStatus"
          }
        },
        "target": {
          "description": "Lab target cost",
          "format": "int32",
          "type": "integer"
        }
      },
      "type": "object"
    }
  }
}