{
  "$defs": {
    "linkUrl": {
      "description": "Target for links or buttons",
      "format": "uri",
      "type": "string"
    },
    "plainText": {
      "description": "Plain text (no HTML allowed)",
      "type": "string"
    }
  },
  "$id": "file:///ExtensionDoorhanger.schema.json",
  "$schema": "https://json-schema.org/draft/2019-09/schema",
  "additionalProperties": true,
  "allOf": [
    {
      "$ref": "file:///FxMSCommon.schema.json#/$defs/Message"
    }
  ],
  "description": "A template with a heading, addon icon, title and description. No markup allowed.",
  "properties": {
    "content": {
      "additionalProperties": true,
      "if": {
        "properties": {
          "skip_address_bar_notifier": {
            "anyOf": [
              {
                "const": "false"
              },
              {
                "const": null
              }
            ]
          }
        }
      },
      "properties": {
        "addon": {
          "description": "Addon information including AMO URL.",
          "properties": {
            "amo_url": {
              "$ref": "#/$defs/linkUrl",
              "description": "Link that offers more information related to the addon."
            },
            "author": {
              "$ref": "#/$defs/plainText",
              "description": "Addon author"
            },
            "icon": {
              "$ref": "#/$defs/linkUrl",
              "description": "The icon displayed in the pop-over. Should be 64x64px and png/svg."
            },
            "id": {
              "$ref": "#/$defs/plainText",
              "description": "Unique addon ID"
            },
            "rating": {
              "description": "Star rating",
              "type": "string"
            },
            "title": {
              "$ref": "#/$defs/plainText",
              "description": "Addon name"
            },
            "users": {
              "description": "Installed users",
              "type": "string"
            }
          },
          "required": [
            "title",
            "author",
            "icon",
            "amo_url"
          ],
          "type": "object"
        },
        "alt_anchor_id": {
          "description": "An alternate DOM element ID that the pop-over will be anchored.",
          "type": "string"
        },
        "anchor_id": {
          "description": "A DOM element ID that the pop-over will be anchored.",
          "type": "string"
        },
        "bucket_id": {
          "description": "A bucket identifier for the addon. This is used in order to anonymize telemetry for history-sensitive targeting.",
          "type": "string"
        },
        "buttons": {
          "description": "The label and functionality for the buttons in the pop-over.",
          "properties": {
            "primary": {
              "properties": {
                "action": {
                  "properties": {
                    "data": {
                      "properties": {
                        "url": {
                          "$comment": "This is dynamically generated from the addon.id. See CFRPageActions.jsm",
                          "description": "URL used in combination with the primary action dispatched.",
                          "type": "string"
                        }
                      }
                    },
                    "type": {
                      "description": "Action dispatched by the button.",
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "label": {
                  "description": "Id of localized string or message override.",
                  "oneOf": [
                    {
                      "properties": {
                        "attributes": {
                          "description": "Button attributes.",
                          "properties": {
                            "accesskey": {
                              "description": "A single character to be used as a shortcut key for the secondary button. This should be one of the characters that appears in the button label.",
                              "type": "string"
                            }
                          },
                          "required": [
                            "accesskey"
                          ],
                          "type": "object"
                        },
                        "value": {
                          "$ref": "#/$defs/plainText",
                          "description": "Button label override used when a localized version is not available."
                        }
                      },
                      "required": [
                        "value",
                        "attributes"
                      ]
                    },
                    {
                      "$ref": "file:///FxMSCommon.schema.json#/$defs/localizedText"
                    }
                  ],
                  "type": "object"
                }
              },
              "type": "object"
            },
            "secondary": {
              "items": {
                "properties": {
                  "action": {
                    "properties": {
                      "data": {
                        "properties": {
                          "url": {
                            "allOf": [
                              {
                                "$ref": "#/$defs/linkUrl"
                              },
                              {
                                "description": "URL used in combination with the primary action dispatched."
                              }
                            ]
                          }
                        }
                      },
                      "type": {
                        "description": "Action dispatched by the button.",
                        "type": "string"
                      }
                    },
                    "type": "object"
                  },
                  "label": {
                    "description": "Id of localized string or message override.",
                    "oneOf": [
                      {
                        "properties": {
                          "attributes": {
                            "description": "Button attributes.",
                            "properties": {
                              "accesskey": {
                                "description": "A single character to be used as a shortcut key for the secondary button. This should be one of the characters that appears in the button label.",
                                "type": "string"
                              }
                            },
                            "required": [
                              "accesskey"
                            ],
                            "type": "object"
                          },
                          "value": {
                            "allOf": [
                              {
                                "$ref": "#/$defs/plainText"
                              },
                              {
                                "description": "Button label override used when a localized version is not available."
                              }
                            ]
                          }
                        },
                        "required": [
                          "value",
                          "attributes"
                        ]
                      },
                      {
                        "properties": {
                          "string_id": {
                            "allOf": [
                              {
                                "$ref": "#/$defs/plainText"
                              },
                              {
                                "description": "Id of localized string for button"
                              }
                            ]
                          }
                        },
                        "required": [
                          "string_id"
                        ]
                      }
                    ],
                    "type": "object"
                  }
                },
                "type": "object"
              },
              "type": "array"
            }
          },
          "type": "object"
        },
        "category": {
          "description": "Attribute used for different groups of messages from the same provider",
          "type": "string"
        },
        "descriptionDetails": {
          "description": "Additional information and steps on how to use",
          "properties": {
            "steps": {
              "description": "Array of string_ids",
              "items": {
                "$ref": "file:///FxMSCommon.schema.json#/$defs/localizedText",
                "description": "Id of string to localized addon description"
              },
              "type": "array"
            }
          },
          "required": [
            "steps"
          ],
          "type": "object"
        },
        "heading_text": {
          "$ref": "file:///FxMSCommon.schema.json#/$defs/localizableText",
          "description": "The larger heading text displayed in the pop-over. This can be a reference to a localized string in Firefox or just a plain string."
        },
        "icon": {
          "$ref": "#/$defs/linkUrl",
          "description": "The icon displayed in the pop-over. Should be 32x32px or 64x64px and png/svg."
        },
        "icon_class": {
          "description": "CSS class of the pop-over icon.",
          "type": "string"
        },
        "icon_dark_theme": {
          "description": "Pop-over icon, dark theme variant. Should be 32x32px or 64x64px and png/svg.",
          "type": "string"
        },
        "info_icon": {
          "description": "The small icon displayed in the top right corner of the pop-over. Should be 19x19px, svg or png. Defaults to a small question mark.",
          "properties": {
            "label": {
              "oneOf": [
                {
                  "properties": {
                    "attributes": {
                      "properties": {
                        "tooltiptext": {
                          "$ref": "file:///FxMSCommon.schema.json#/$defs/localizableText",
                          "description": "Text for button tooltip used to provide information about the doorhanger."
                        }
                      },
                      "required": [
                        "tooltiptext"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "attributes"
                  ],
                  "type": "object"
                },
                {
                  "$ref": "file:///FxMSCommon.schema.json#/$defs/localizedText"
                }
              ]
            },
            "sumo_path": {
              "description": "Last part of the path in the URL to the support page with the information about the doorhanger.",
              "examples": [
                "extensionpromotions",
                "extensionrecommendations"
              ],
              "type": "string"
            }
          },
          "type": "object"
        },
        "layout": {
          "description": "Attribute used for different groups of messages from the same provider",
          "enum": [
            "short_message",
            "icon_and_message",
            "addon_recommendation"
          ],
          "type": "string"
        },
        "learn_more": {
          "description": "Last part of the path in the SUMO URL to the support page with the information about the doorhanger.",
          "examples": [
            "extensionpromotions",
            "extensionrecommendations"
          ],
          "type": "string"
        },
        "notification_text": {
          "$ref": "file:///FxMSCommon.schema.json#/$defs/localizableText",
          "description": "The text in the small blue chicklet that appears in the URL bar. This can be a reference to a localized string in Firefox or just a plain string."
        },
        "persistent_doorhanger": {
          "description": "Prevent the doorhanger from being dismissed if user interacts with the page or switches between applications.",
          "type": "boolean"
        },
        "show_in_private_browsing": {
          "description": "Whether to allow the message to be shown in private browsing mode. Defaults to false.",
          "type": "boolean"
        },
        "skip_address_bar_notifier": {
          "description": "Skip the 'Recommend' notifier and show directly.",
          "type": "boolean"
        },
        "text": {
          "$ref": "file:///FxMSCommon.schema.json#/$defs/localizableText",
          "description": "The body text displayed in the pop-over. This can be a reference to a localized string in Firefox or just a plain string."
        }
      },
      "required": [
        "layout",
        "bucket_id",
        "heading_text",
        "text",
        "buttons"
      ],
      "then": {
        "required": [
          "category",
          "notification_text"
        ]
      },
      "type": "object"
    },
    "template": {
      "enum": [
        "cfr_doorhanger",
        "milestone_message"
      ],
      "type": "string"
    }
  },
  "required": [
    "targeting",
    "trigger"
  ],
  "title": "ExtensionDoorhanger",
  "type": "object"
}