{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schema.mp.microsoft.com/schema/product/2022-03-01-preview3",
  "title": "Microsoft Product Ingestion product schema",
  "allOf": [
    {
      "$ref": "https://schema.mp.microsoft.com/schema/resource/2022-03-01-preview2"
    },
    {
      "type": "object",
      "properties": {
        "productGroup": {
          "$ref": "https://schema.mp.microsoft.com/schema/resource-reference/2022-03-01-preview2"
        },
        "identity": {
          "$ref": "#/$defs/identity"
        },
        "type": {
          "type": "string",
          "enum": [
            "azureApplication",
            "azureContainer",
            "azureVirtualMachine",
            "consultingService",
            "containerApp",
            "coreVirtualMachine",
            "cosellOnly",
            "dynamics365BusinessCentral",
            "dynamics365ForCustomerEngagement",
            "dynamics365ForOperations",
            "iotEdgeModule",
            "managedService",
            "powerBiApp",
            "powerBiVisual",
            "softwareAsAService",
            "xbox360NonBackcompat"
          ]
        },
        "alias": {
          "type": "string",
          "maxLength": 120
        },
        "lifecycleState": {
          "$ref": "https://schema.mp.microsoft.com/schema/resource-lifecycle-state/2022-03-01-preview2",
          "default": "generallyAvailable",
          "enum": [
            "generallyAvailable",
            "deprecated",
            "deleted"
          ]
        },
        "deprecationSchedule": {
          "$ref": "https://schema.mp.microsoft.com/schema/deprecation-schedule/2022-03-01-preview2"
        }
      },
      "required": [
        "identity",
        "type",
        "alias"
      ],
      "if": {
        "properties": {
          "type": {
            "enum": [
              "xbox360NonBackcompat"
            ]
          }
        }
      },
      "then": {
        "properties": {
          "identity": {
            "$ref": "#/$defs/xbox360Identity"
          }
        }
      }
    }
  ],
  "$defs": {
    "https://schema.mp.microsoft.com/schema/resource/2022-03-01-preview2": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "$id": "https://schema.mp.microsoft.com/schema/resource/2022-03-01-preview2",
      "$comment": "This schema is extended by a resource type schema. We allow additional properties to enable that",
      "type": "object",
      "properties": {
        "resourceName": {
          "type": "string",
          "minLength": 1,
          "maxLength": 50
        },
        "id": {
          "$ref": "https://schema.mp.microsoft.com/schema/durable-id/2022-03-01-preview2"
        },
        "validations": {
          "type": "array",
          "items": {
            "$ref": "https://schema.mp.microsoft.com/schema/validation/2022-03-01-preview2"
          },
          "readonly": true
        }
      },
      "required": [
        "$schema"
      ],
      "additionalProperties": true
    },
    "https://schema.mp.microsoft.com/schema/resource-reference/2022-03-01-preview2": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "$id": "https://schema.mp.microsoft.com/schema/resource-reference/2022-03-01-preview2",
      "oneOf": [
        {
          "$ref": "https://schema.mp.microsoft.com/schema/durable-id/2022-03-01-preview2"
        },
        {
          "type": "object",
          "properties": {
            "externalId": {
              "description": "ExternalId for product and plan references. Property reference must be named product or plan.",
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9-_]{2,49}$",
              "minLength": 3,
              "maxLength": 50,
              "$example": {
                "plan": {
                  "externalId": "customerNamedPlan123"
                }
              }
            }
          },
          "required": [
            "externalId"
          ]
        },
        {
          "type": "object",
          "properties": {
            "resourceName": {
              "description": "Resource Name that can be referenced using this value by another resource.",
              "type": "string",
              "pattern": "^[a-zA-Z0-9-_]\u002B$",
              "minLength": 1,
              "maxLength": 50,
              "$example": {
                "plan": {
                  "resourceName": "resourcePlan1"
                }
              }
            }
          },
          "required": [
            "resourceName"
          ]
        }
      ]
    },
    "https://schema.mp.microsoft.com/schema/resource-lifecycle-state/2022-03-01-preview2": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "$id": "https://schema.mp.microsoft.com/schema/resource-lifecycle-state/2022-03-01-preview2",
      "type": "string",
      "$comment": "deleted only if in draft and never published. Deprecated replaces StopSold",
      "enum": [
        "notAvailable",
        "neverUsed",
        "test",
        "preview",
        "generallyAvailable",
        "deprecated",
        "decommissioned",
        "deleted"
      ]
    },
    "https://schema.mp.microsoft.com/schema/deprecation-schedule/2022-03-01-preview2": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "$id": "https://schema.mp.microsoft.com/schema/deprecation-schedule/2022-03-01-preview2",
      "description": "Defines a \u003Cwhat\u003E schedule for a deprecated resource",
      "type": "object",
      "properties": {
        "$schema": {
          "$ref": "https://schema.mp.microsoft.com/schema/schema-uri/2022-03-01-preview2"
        },
        "date": {
          "type": "string",
          "format": "date",
          "readOnly": true
        },
        "dateOffset": {
          "type": "string",
          "format": "duration"
        },
        "reason": {
          "type": "string",
          "enum": [
            "criticalSecurityIssue",
            "endOfSupport",
            "other"
          ]
        },
        "alternative": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "product": {
                  "$ref": "https://schema.mp.microsoft.com/schema/resource-reference/2022-03-01-preview2"
                }
              },
              "required": [
                "product"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "plan": {
                  "$ref": "https://schema.mp.microsoft.com/schema/resource-reference/2022-03-01-preview2"
                }
              },
              "required": [
                "plan"
              ],
              "additionalProperties": false
            }
          ]
        }
      },
      "additionalProperties": false
    },
    "https://schema.mp.microsoft.com/schema/durable-id/2022-03-01-preview2": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "$id": "https://schema.mp.microsoft.com/schema/durable-id/2022-03-01-preview2",
      "description": "A durable-id to an existing resource.",
      "type": "string",
      "pattern": "^[a-z](-?[a-z0-9]\u002B)*/[a-z0-9-]\u002B(\\/?[a-z0-9-])*$"
    },
    "https://schema.mp.microsoft.com/schema/validation/2022-03-01-preview2": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "$id": "https://schema.mp.microsoft.com/schema/validation/2022-03-01-preview2",
      "allOf": [
        {
          "$ref": "https://schema.mp.microsoft.com/schema/inner-error/2022-03-01-preview2"
        },
        {
          "properties": {
            "$schema": {
              "$ref": "https://schema.mp.microsoft.com/schema/schema-uri/2022-03-01-preview2"
            },
            "level": {
              "type": "string",
              "enum": [
                "informational",
                "warning"
              ]
            }
          },
          "required": [
            "level"
          ]
        }
      ]
    },
    "https://schema.mp.microsoft.com/schema/inner-error/2022-03-01-preview2": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "$id": "https://schema.mp.microsoft.com/schema/inner-error/2022-03-01-preview2",
      "type": "object",
      "properties": {
        "resourceId": {
          "$ref": "https://schema.mp.microsoft.com/schema/resource-reference/2022-03-01-preview2"
        },
        "code": {
          "type": "string",
          "readOnly": true,
          "enum": [
            "businessValidationError",
            "collectionLimitExceeded",
            "invalidId",
            "invalidEntityStatus",
            "invalidRequest",
            "invalidResource",
            "invalidState",
            "notDeployed",
            "notSupported",
            "operationCanceled",
            "productLocked",
            "resourceNotFound",
            "schemaValidationError"
          ]
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "array",
          "items": {
            "$ref": "https://schema.mp.microsoft.com/schema/inner-error/2022-03-01-preview2"
          }
        }
      },
      "required": [
        "code"
      ]
    },
    "https://schema.mp.microsoft.com/schema/schema-uri/2022-03-01-preview2": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "$id": "https://schema.mp.microsoft.com/schema/schema-uri/2022-03-01-preview2",
      "title": "Product Ingestion schema uri",
      "type": "string",
      "pattern": "^https://(schema(-int)?\\.mp\\.microsoft\\.com)|(product-ingestion(-int)?\\.azureedge\\.net)/schema/[a-z][a-z0-9]\u002B(?:-[a-z0-9]\u002B)*/\\d{4}(?:-\\d\\d){2}(?:-dev|-preview\\d\u002B)?$"
    },
    "identity": {
      "type": "object",
      "properties": {
        "externalId": {
          "type": "string",
          "minLength": 3,
          "maxLength": 50,
          "pattern": "^[a-z0-9][a-z0-9-_]{2,49}$"
        }
      },
      "required": [
        "externalId"
      ]
    },
    "xbox360Identity": {
      "type": "object",
      "properties": {
        "legacyXboxProductId": {
          "type": "string",
          "format": "uuid"
        },
        "legacyXboxProductType": {
          "type": "string",
          "enum": [
            "addonExtension",
            "arcade",
            "avatar",
            "x360Disc",
            "gameAddon",
            "gamerTile",
            "gameTrailer",
            "gameVideo",
            "theme",
            "x360GameConsumable",
            "xbo"
          ]
        },
        "storeId": {
          "type": "string",
          "readOnly": true
        },
        "xboxTitleId": {
          "type": "string",
          "pattern": "^[1-9][0-9]{0,19}$"
        }
      },
      "required": [
        "legacyXboxProductId",
        "legacyXboxProductType",
        "storeId",
        "xboxTitleId"
      ]
    }
  }
}