{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-sql-database/json-schema/microsoft-azure-sql-database-long-term-retention-policy-schema.json",
  "title": "LongTermRetentionPolicy",
  "description": "A long term retention policy.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/microsoft-azure-sql-database-longtermretentionpolicies-api-openapi.yml#/components/schemas/LongTermRetentionPolicy",
  "type": "object",
  "properties": {
    "properties": {
      "$ref": "#/$defs/LongTermRetentionPolicyProperties",
      "description": "Resource properties.",
      "x-ms-client-flatten": true
    }
  },
  "allOf": [
    {
      "$ref": "#/$defs/ProxyResource"
    }
  ],
  "$defs": {
    "LongTermRetentionPolicyProperties": {
      "type": "object",
      "description": "Properties of a long term retention policy",
      "properties": {
        "timeBasedImmutability": {
          "$ref": "#/$defs/TimeBasedImmutability",
          "description": "The setting for whether to enable time-based immutability for future backups. When set, future backups will have TimeBasedImmutability enabled."
        },
        "timeBasedImmutabilityMode": {
          "$ref": "#/$defs/TimeBasedImmutabilityMode",
          "description": "The setting for time-based immutability mode for future backup (Value can be either Locked or UnLocked. Only effective if TimeBasedImmutability is enabled). Caution: Immutability of LTR backup cannot be removed if TimeBasedImmutabilityMode is Locked."
        },
        "weeklyRetention": {
          "type": "string",
          "description": "The weekly retention policy for an LTR backup in an ISO 8601 format."
        },
        "monthlyRetention": {
          "type": "string",
          "description": "The monthly retention policy for an LTR backup in an ISO 8601 format."
        },
        "yearlyRetention": {
          "type": "string",
          "description": "The yearly retention policy for an LTR backup in an ISO 8601 format."
        },
        "weekOfYear": {
          "type": "integer",
          "format": "int32",
          "description": "The week of year to take the yearly backup in an ISO 8601 format."
        }
      }
    },
    "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"
        }
      ]
    },
    "Resource": {
      "type": "object",
      "description": "Referenced by this document but never defined in it. API Evangelist added this empty placeholder so the document resolves; the shape is unknown and is NOT a claim about the API.",
      "x-ae-placeholder": true
    },
    "TimeBasedImmutability": {
      "type": "string",
      "description": "The setting for whether or not time-based immutability is enabled for the LTR backup. When time-based immutability is enabled and locked, the backup cannot be deleted until BackupExpirationTime.",
      "enum": [
        "Enabled",
        "Disabled"
      ],
      "x-ms-enum": {
        "name": "TimeBasedImmutability",
        "modelAsString": true,
        "values": [
          {
            "name": "Enabled",
            "value": "Enabled",
            "description": "Enabled"
          },
          {
            "name": "Disabled",
            "value": "Disabled",
            "description": "Disabled"
          }
        ]
      }
    },
    "TimeBasedImmutabilityMode": {
      "type": "string",
      "description": "The time-based immutability mode. Only applicable if time-based immutability is enabled.",
      "enum": [
        "Locked",
        "Unlocked"
      ],
      "x-ms-enum": {
        "name": "TimeBasedImmutabilityMode",
        "modelAsString": true,
        "values": [
          {
            "name": "Locked",
            "value": "Locked",
            "description": "Locked"
          },
          {
            "name": "Unlocked",
            "value": "Unlocked",
            "description": "Unlocked"
          }
        ]
      }
    }
  }
}