{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "definitions": {
    "icon": {
      "type": "string",
      "pattern": "\\.png$"
    },
    "color": {
      "description": "The format of the color values is 'RRGGBB' where RR is the hex value for red, GG for green, and BB for blue.",
      "type": "string",
      "pattern": "^[A-Fa-f0-9]{6}$"
    },
    "elementId": {
      "description": "The numeric id of the icon layout element based on the predefined layout selected.",
      "enum": ["1", "2", "3", "11", "12", "21", "22", "31", "32"]
    },
    "condition": {
      "description": "If set, then must be set to 'true' for this release",
      "enum": ["true"]
    },
    "resource": {
      "type": "object",
      "required": ["url", "style", "content"],
      "properties": {
        "url": {
          "description": "The URL to be referenced. For resources that require authentication, the URL must be HTTPS.",
          "type": "string",
          "format": "uri"
        },
        "style": {
          "description": "Specifies the kind of web resource being accessed. Permitted values are 'Simple' and 'Feed'.",
          "type": "string",
          "pattern": "^([sS]imple|[fF]eed)$",
          "default": "Simple"
        },
        "content": {
          "description": "This member specifies how to extract content from the web response.",
          "type": "object",
          "minProperties": 1,
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    },
    "page": {
      "required": ["layout"],
      "properties": {
        "layout": {
          "description": "The name of the layout for the page. The layout name should refer to one of the predefined page layouts.",
          "enum": [
            "MSBand_ScrollingText",
            "MSBand_NoScrollingText",
            "MSBand_SingleMetric",
            "MSBand_SingleMetricWithIcon",
            "MSBand_MetricsWithIcons",
            "MSBand_SingleMetricWithSecondary"
          ]
        },
        "condition": {
          "$ref": "#/definitions/condition"
        },
        "iconBindings": {
          "description": "Similar to textBindings, but used to select one of the web tile icons in icons list for each icon in the page. If there are no icon elements on the page, this member may be omitted.",
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/definitions/iconBinding"
          }
        },
        "textBindings": {
          "description": "An array of objects corresponding to each page element that contains string content. Each binding object provides the numeric id of the page element based on the predefined layout selected, and the string value that it should contain.",
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/definitions/textBinding"
          }
        }
      }
    },
    "iconBinding": {
      "required": ["conditions", "elementId"],
      "type": "object",
      "properties": {
        "elementId": {
          "$ref": "#/definitions/elementId"
        },
        "conditions": {
          "description": "For this release, this must contain an array with a single 'condition' object whose 'condition' is true, and whose 'icon' member specifies the name of the icon to be used.",
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "condition": {
                "$ref": "#/definitions/condition"
              },
              "icon": {
                "description": "The name of the icon as specified in the 'icons' node.",
                "type": "string"
              }
            }
          }
        }
      }
    },
    "textBinding": {
      "required": ["elementId", "value"],
      "properties": {
        "elementId": {
          "$ref": "#/definitions/elementId"
        },
        "value": {
          "type": "string"
        }
      }
    },
    "notification": {
      "type": "object",
      "required": ["condition", "title"],
      "properties": {
        "condition": {
          "description": "The condition to be evaluated to determine whether to trigger the notification. The conditional expression has the syntax '<Operand1> <Operator> <Operand2>' or 'true'.",
          "type": "string"
        },
        "title": {
          "description": "The text to use for the notification title. If longer than 20 characters, it will be truncated.",
          "type": "string"
        },
        "body": {
          "description": "The text to use for the notification body. If longer than 20 characters, it will be truncated.",
          "type": "string"
        }
      }
    }
  },
  "id": "https://json.schemastore.org/band-manifest.json",
  "properties": {
    "manifestVersion": {
      "description": "Defines the contract between the web tile developer and the Microsoft Health app. It must be set to 1 for the current release.",
      "enum": [1]
    },
    "name": {
      "description": "Defines the name of the web tile.",
      "type": "string",
      "maxLength": 21
    },
    "description": {
      "description": "Provides description about the web tile.",
      "type": "string",
      "maxLength": 100
    },
    "version": {
      "description": "Indicates the version number of the web tile which will not be shown to users.",
      "type": "number"
    },
    "versionString": {
      "description": "Indicates the web tile version as shown to users. If not provided, it displays the version.",
      "type": "string",
      "maxLength": 10
    },
    "author": {
      "description": "Specifies the author of the web tile.",
      "type": "string",
      "maxLength": 50
    },
    "organization": {
      "description": "Specifies the organization associated with the web tile.",
      "type": "string",
      "maxLength": 100
    },
    "contactEmail": {
      "description": "Provides contact info of the web tile author. Used for administrative purposes and analytics by Microsoft Band team.",
      "type": "string",
      "format": "email",
      "maxLength": 100
    },
    "tileIcon": {
      "description": "Specifies the location of the large tile icon.",
      "type": "object",
      "required": ["46"],
      "properties": {
        "46": {
          "$ref": "#/definitions/icon"
        }
      }
    },
    "badgeIcon": {
      "description": "Specifies the location of the small tile icon. If not provided, the badging functionality is not enabled.",
      "type": "object",
      "required": ["24"],
      "properties": {
        "24": {
          "$ref": "#/definitions/icon"
        }
      }
    },
    "tileTheme": {
      "description": "Specifies the custom theme colors for the web tile.",
      "type": "object",
      "properties": {
        "base": {
          "$ref": "#/definitions/color"
        },
        "highlight": {
          "$ref": "#/definitions/color"
        },
        "lowlight": {
          "$ref": "#/definitions/color"
        },
        "secondary": {
          "$ref": "#/definitions/color"
        },
        "highcontrast": {
          "$ref": "#/definitions/color"
        },
        "muted": {
          "$ref": "#/definitions/color"
        }
      }
    },
    "refreshIntervalMinutes": {
      "description": "Specifies the desired data refresh interval, in minutes. Refresh intervals shorter than 15 will not be honored. If not provided, it defaults to 30.",
      "type": "integer",
      "default": 30,
      "minimum": 15
    },
    "resources": {
      "description": "Each web tile must refer to one or more web resources. Each resource object describes a web data from which content for the tile will be extracted.",
      "type": "array",
      "items": {
        "$ref": "#/definitions/resource"
      }
    },
    "icons": {
      "description": "All PNG icons used by the tile within its pages must be provided here.",
      "type": "object",
      "maxProperties": 8,
      "additionalProperties": {
        "$ref": "#/definitions/icon"
      }
    },
    "pages": {
      "description": "Each tile consists of one or more pages, as described by the objects in this array. Each page object specifies the layout and content of the page.",
      "type": "array",
      "items": {
        "$ref": "#/definitions/page"
      }
    },
    "notifications": {
      "description": "Creates notification that gets delivered when certain conditions are detected in the new web data.",
      "type": "array",
      "items": {
        "$ref": "#/definitions/notification"
      }
    }
  },
  "required": ["manifestVersion", "name", "tileIcon", "resources", "pages"],
  "title": "JSON schema for Microsoft Band manifests",
  "type": "object"
}