{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-sql-database/json-schema/microsoft-azure-sql-database-database-automatic-tuning-schema.json",
  "title": "DatabaseAutomaticTuning",
  "description": "Database-level Automatic Tuning.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/microsoft-azure-sql-database-databaseautomatictuning-api-openapi.yml#/components/schemas/DatabaseAutomaticTuning",
  "type": "object",
  "properties": {
    "properties": {
      "$ref": "#/$defs/DatabaseAutomaticTuningProperties",
      "description": "Resource properties.",
      "x-ms-client-flatten": true
    }
  },
  "allOf": [
    {
      "$ref": "#/$defs/ProxyResource"
    }
  ],
  "$defs": {
    "AutomaticTuningDisabledReason": {
      "type": "string",
      "description": "Reason description if desired and actual state are different.",
      "enum": [
        "Default",
        "Disabled",
        "AutoConfigured",
        "InheritedFromServer",
        "QueryStoreOff",
        "QueryStoreReadOnly",
        "NotSupported"
      ],
      "x-ms-enum": {
        "name": "AutomaticTuningDisabledReason",
        "modelAsString": false,
        "values": [
          {
            "name": "Default",
            "value": "Default",
            "description": "Default"
          },
          {
            "name": "Disabled",
            "value": "Disabled",
            "description": "Disabled"
          },
          {
            "name": "AutoConfigured",
            "value": "AutoConfigured",
            "description": "AutoConfigured"
          },
          {
            "name": "InheritedFromServer",
            "value": "InheritedFromServer",
            "description": "InheritedFromServer"
          },
          {
            "name": "QueryStoreOff",
            "value": "QueryStoreOff",
            "description": "QueryStoreOff"
          },
          {
            "name": "QueryStoreReadOnly",
            "value": "QueryStoreReadOnly",
            "description": "QueryStoreReadOnly"
          },
          {
            "name": "NotSupported",
            "value": "NotSupported",
            "description": "NotSupported"
          }
        ]
      }
    },
    "AutomaticTuningMode": {
      "type": "string",
      "description": "Automatic tuning desired state.",
      "enum": [
        "Inherit",
        "Custom",
        "Auto",
        "Unspecified"
      ],
      "x-ms-enum": {
        "name": "AutomaticTuningMode",
        "modelAsString": false,
        "values": [
          {
            "name": "Inherit",
            "value": "Inherit",
            "description": "Inherit"
          },
          {
            "name": "Custom",
            "value": "Custom",
            "description": "Custom"
          },
          {
            "name": "Auto",
            "value": "Auto",
            "description": "Auto"
          },
          {
            "name": "Unspecified",
            "value": "Unspecified",
            "description": "Unspecified"
          }
        ]
      }
    },
    "AutomaticTuningOptionModeActual": {
      "type": "string",
      "description": "Automatic tuning option actual state.",
      "enum": [
        "Off",
        "On"
      ],
      "x-ms-enum": {
        "name": "AutomaticTuningOptionModeActual",
        "modelAsString": false,
        "values": [
          {
            "name": "Off",
            "value": "Off",
            "description": "Off"
          },
          {
            "name": "On",
            "value": "On",
            "description": "On"
          }
        ]
      }
    },
    "AutomaticTuningOptionModeDesired": {
      "type": "string",
      "description": "Automatic tuning option desired state.",
      "enum": [
        "Off",
        "On",
        "Default"
      ],
      "x-ms-enum": {
        "name": "AutomaticTuningOptionModeDesired",
        "modelAsString": false,
        "values": [
          {
            "name": "Off",
            "value": "Off",
            "description": "Off"
          },
          {
            "name": "On",
            "value": "On",
            "description": "On"
          },
          {
            "name": "Default",
            "value": "Default",
            "description": "Default"
          }
        ]
      }
    },
    "AutomaticTuningOptions": {
      "type": "object",
      "description": "Automatic tuning properties for individual advisors.",
      "properties": {
        "desiredState": {
          "$ref": "#/$defs/AutomaticTuningOptionModeDesired",
          "description": "Automatic tuning option desired state."
        },
        "actualState": {
          "$ref": "#/$defs/AutomaticTuningOptionModeActual",
          "description": "Automatic tuning option actual state.",
          "readOnly": true
        },
        "reasonCode": {
          "type": "integer",
          "format": "int32",
          "description": "Reason code if desired and actual state are different.",
          "readOnly": true
        },
        "reasonDesc": {
          "$ref": "#/$defs/AutomaticTuningDisabledReason",
          "description": "Reason description if desired and actual state are different.",
          "readOnly": true
        }
      }
    },
    "DatabaseAutomaticTuningProperties": {
      "type": "object",
      "description": "Database-level Automatic Tuning properties.",
      "properties": {
        "desiredState": {
          "$ref": "#/$defs/AutomaticTuningMode",
          "description": "Automatic tuning desired state."
        },
        "actualState": {
          "$ref": "#/$defs/AutomaticTuningMode",
          "description": "Automatic tuning actual state.",
          "readOnly": true
        },
        "options": {
          "type": "object",
          "description": "Automatic tuning options definition.",
          "additionalProperties": {
            "$ref": "#/$defs/AutomaticTuningOptions"
          }
        }
      }
    },
    "ProxyResource": {
      "type": "object",
      "title": "Proxy Resource",
      "description": "The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location",
      "allOf": [
        {
          "$ref": "#/$defs/Resource"
        }
      ]
    }
  }
}