{
  "$id": "https://ordergroove.com/plush-toys/offers/schema.json",
  "definitions": {
    "OfferType": {
      "type": "string",
      "default": "radio"
    },
    "Frequency": {
      "type": "object",
      "properties": {
        "every": {
          "type": "number",
          "title": "Every",
          "minimum": 1,
          "maximum": 365,
          "default": 1
        },
        "period": {
          "type": "number",
          "title": "Period",
          "enum": [1, 2, 3],
          "enumNames": ["Days", "Weeks", "Months"]
        }
      }
    },
    "Font": {
      "type": "object",
      "properties": {
        "family": {
          "title": "Font",
          "type": "string"
        },
        "color": {
          "title": "Color",
          "type": "string"
        },
        "size": {
          "title": "Size",
          "type": ["string", "number"]
        }
      }
    },
    "SubscriptionUpsellTextCopies": {
      "title": "Copy",
      "type": "object",
      "properties": {
        "upsellButtonLabel": {
          "type": "string",
          "default": "Add to upcoming subscription order and receive 20% off",
          "title": "Upsell copy"
        },
        "upsellButtonContent": {
          "type": "string",
          "default": "Add to Next Order on ",
          "title": "Upsell button copy"
        },
        "upsellModalContent": {
          "type": "string",
          "default": "Subscribe to this product and have it conveniently delivered to you at the frequency you choose. Promotion subject to change.",
          "title": "Upsell modal copy"
        },
        "upsellModalOptOutLabel": {
          "type": "string",
          "default": "Get one-time",
          "title": "Upsell modal one-time option copy"
        },
        "upsellModalOptInLabel": {
          "type": "string",
          "default": "Subscribe and get 10% off on every order",
          "title": "Upsell modal subscribe option copy"
        },
        "upsellModalConfirmLabel": {
          "type": "string",
          "default": "Add",
          "title": "Upsell modal add button"
        },
        "upsellModalCancelLabel": {
          "type": "string",
          "default": "Cancel",
          "title": "Upsell modal cancel button"
        },
        "upsellConfirmation": {
          "type": "string",
          "default": "You will receive this item in your next order on ",
          "title": "Upsell confirmation text"
        }
      }
    },
    "SubscriptionUpsellBasicStyles": {
      "type": "object",
      "title": "Styling",
      "properties": {
        "global": {
          "$ref": "#/definitions/Font",
          "default": {
            "family": "inherit",
            "size": "inherit",
            "color": "inherit"
          }
        },
        "upsellBackground": {
          "type": "string",
          "default": "#298266"
        },
        "upsell": {
          "$ref": "#/definitions/Font",
          "default": {
            "family": "Arial, Helvetica, sans-serif",
            "size": "13px",
            "color": "#298266"
          }
        },
        "modalButton": {
          "$ref": "#/definitions/Font",
          "default": {
            "family": "Arial, Helvetica, sans-serif",
            "size": "13px",
            "color": "#333333"
          }
        },
        "confirmButtonBackground": {
          "type": "string",
          "default": "#00449e"
        },
        "confirmButtonColor": {
          "type": "string",
          "default": "#fff"
        },
        "modalButtonBackground": {
          "type": "string",
          "default": "#e6e6e6"
        }
      }
    },
    "SubscriptionUpsellVariation": {
      "type": "object",
      "properties": {
        "name": {
          "title": "Name",
          "type": "string"
        },
        "selector": {
          "title": "Selector",
          "type": "string"
        },
        "advancedMode": {
          "type": "boolean",
          "default": false,
          "title": "Toggle advanced html and css offer editing"
        }
      },
      "dependencies": {
        "advancedMode": {
          "oneOf": [
            {
              "properties": {
                "advancedMode": {
                  "enum": [false]
                },
                "settings": {
                  "title": "Settings",
                  "type": "object",
                  "properties": {
                    "defaultFrequency": {
                      "title": "Default frequency selection",
                      "$ref": "#/definitions/Frequency"
                    },
                    "offerType": {
                      "title": "Type",
                      "$ref": "#/definitions/OfferType"
                    }
                  }
                },
                "textCopy": {
                  "$ref": "#/definitions/SubscriptionUpsellTextCopies"
                },
                "styles": {
                  "$ref": "#/definitions/SubscriptionUpsellBasicStyles"
                }
              }
            },
            {
              "properties": {
                "advancedMode": {
                  "enum": [true]
                },
                "markup": {
                  "type": "string",
                  "title": "HTML Source"
                },
                "css": {
                  "type": "string",
                  "title": "CSS Source"
                }
              },
              "required": ["advancedMode", "markup"]
            }
          ]
        }
      }
    },
    "SubscriptionUpsell": {
      "type": "object",
      "properties": {
        "advancedMode": {
          "type": "boolean",
          "default": false,
          "title": "Toggle advanced html and css offer editing"
        },
        "elements": {
          "title": "Variations",
          "type": "array",
          "items": {
            "$ref": "#/definitions/SubscriptionUpsellVariation"
          },
          "uniqueItems": true
        }
      },
      "dependencies": {
        "advancedMode": {
          "oneOf": [
            {
              "properties": {
                "advancedMode": {
                  "enum": [false]
                },
                "settings": {
                  "title": "Settings",
                  "type": "object",
                  "properties": {
                    "defaultFrequency": {
                      "title": "Default frequency selection",
                      "$ref": "#/definitions/Frequency"
                    },
                    "offerType": {
                      "title": "Type",
                      "$ref": "#/definitions/OfferType"
                    }
                  },
                  "required": ["defaultFrequency", "offerType"]
                },
                "textCopy": {
                  "$ref": "#/definitions/SubscriptionUpsellTextCopies"
                },
                "styles": {
                  "$ref": "#/definitions/SubscriptionUpsellBasicStyles"
                }
              },
              "required": ["settings", "textCopy", "styles"]
            },
            {
              "properties": {
                "advancedMode": {
                  "enum": [true]
                },
                "markup": {
                  "type": "string",
                  "title": "HTML Source"
                },
                "css": {
                  "type": "string",
                  "title": "CSS Source"
                }
              },
              "required": ["advancedMode", "markup"]
            }
          ]
        }
      }
    },
    "SubscriptionEnrollmentTextCopies": {
      "title": "Copy",
      "type": "object",
      "properties": {
        "defaultFrequencyCopy": {
          "type": "string",
          "default": "(Most Popular)",
          "title": "Default frequency copy"
        },
        "offerOptInLabel": {
          "type": "string",
          "default": "Subscribe to save",
          "title": "Subscription copy"
        },
        "offerIncentiveText": {
          "type": "string",
          "default": "Save {{ogIncentive DiscountPercent}} when you subscribe",
          "title": "Subscription sub copy"
        },
        "offerEveryLabel": {
          "type": "string",
          "default": "Deliver Every",
          "title": "Subscribe frequency label"
        },
        "offerOptOutLabel": {
          "type": "string",
          "default": "Deliver one-time only",
          "title": "One-time option copy"
        },
        "showTooltip": {
          "type": "boolean",
          "default": true,
          "title": "Add a tool tip"
        }
      },
      "dependencies": {
        "showTooltip": {
          "oneOf": [
            {
              "properties": {
                "showTooltip": {
                  "enum": [false]
                }
              }
            },
            {
              "properties": {
                "showTooltip": {
                  "enum": [true]
                },
                "offerTooltipTrigger": {
                  "type": "string",
                  "default": "More info",
                  "title": "Tool tip link copy"
                },
                "offerTooltipContent": {
                  "type": "string",
                  "default": "Subscribe to this product and have it conveniently delivered to you at the frequency you choose. Promotion subject to change.",
                  "title": "Tool tip copy"
                }
              },
              "required": ["showTooltip"]
            }
          ]
        }
      }
    },
    "SubscriptionEnrollmentBasicStyles": {
      "type": "object",
      "title": "Styling",
      "properties": {
        "global": {
          "$ref": "#/definitions/Font",
          "default": {
            "family": "inherit",
            "size": "inherit",
            "color": "inherit"
          }
        },
        "wrapperPadding": {
          "type": "string",
          "default": "10px 0"
        },
        "tooltip": {
          "$ref": "#/definitions/Font",
          "default": {
            "family": "Arial, Helvetica, sans-serif",
            "size": "13px",
            "color": "#298266"
          }
        },
        "tooltipBackground": {
          "type": "string",
          "default": "#ececec"
        },
        "tooltipBoxShadow": {
          "type": "string",
          "default": "2px 2px 6px rgba(0, 0, 0, 0.28)"
        },
        "tooltipPlacement": {
          "type": "string",
          "default": "bottom",
          "enum": ["top", "top-left", "top-right", "bottom", "bottom-left", "bottom-right", "right", "left"]
        }
      }
    },
    "SubscriptionEnrollmentVariation": {
      "type": "object",
      "properties": {
        "name": {
          "title": "Name",
          "type": "string"
        },
        "selector": {
          "title": "Selector",
          "type": "string"
        },
        "advancedMode": {
          "type": "boolean",
          "default": false,
          "title": "Toggle advanced html and css offer editing"
        }
      },
      "dependencies": {
        "advancedMode": {
          "oneOf": [
            {
              "properties": {
                "advancedMode": {
                  "enum": [false]
                },
                "settings": {
                  "title": "Settings",
                  "type": "object",
                  "properties": {
                    "defaultFrequency": {
                      "title": "Default frequency selection",
                      "$ref": "#/definitions/Frequency"
                    },
                    "offerType": {
                      "title": "Type",
                      "$ref": "#/definitions/OfferType"
                    }
                  }
                },
                "textCopy": {
                  "$ref": "#/definitions/SubscriptionEnrollmentTextCopies"
                },
                "styles": {
                  "$ref": "#/definitions/SubscriptionEnrollmentBasicStyles"
                }
              }
            },
            {
              "properties": {
                "advancedMode": {
                  "enum": [true]
                },
                "markup": {
                  "type": "string",
                  "title": "HTML Source"
                },
                "css": {
                  "type": "string",
                  "title": "CSS Source"
                }
              },
              "required": ["advancedMode", "markup"]
            }
          ]
        }
      },
      "default": {
        "settings": {
          "defaultFrequency": { "every": 1, "period": 2 },
          "offerType": "radio"
        },
        "textCopy": {
          "defaultFrequencyCopy": "(Most Popular)",
          "offerOptInLabel": "Subscribe to save",
          "offerIncentiveText": "Save {{ogIncentive DiscountPercent}} when you subscribe",
          "offerEveryLabel": "Deliver Every",
          "offerOptOutLabel": "Deliver one-time only",
          "showTooltip": true,
          "upsellButtonLabel": "Add to upcoming subscription order and receive 20% off",
          "upsellButtonContent": "Add to Next Order on ",
          "upsellModalContent": "Subscribe to this product and have it conveniently delivered to you at the frequency you choose. Promotion subject to change.",
          "upsellModalOptOutLabel": "Get one-time",
          "upsellModalOptInLabel": "Subscribe and get 10% off on every order",
          "upsellModalConfirmLabel": "Add",
          "upsellModalCancelLabel": "Cancel"
        },
        "basicStyles": {
          "global": { "family": "inherit", "size": "inherit", "color": "inherit" },
          "tooltip": { "family": "Arial, Helvetica, sans-serif", "size": "13px", "color": "#298266" },
          "upsellColor": "#c3e7c3",
          "upsell": { "family": "Arial, Helvetica, sans-serif", "size": "13px", "color": "#298266" }
        }
      }
    },
    "SubscriptionEnrollment": {
      "type": "object",
      "properties": {
        "advancedMode": {
          "type": "boolean",
          "default": false,
          "title": "Toggle advanced html and css offer editing"
        },
        "elements": {
          "title": "Configuration",
          "type": "array",
          "items": {
            "$ref": "#/definitions/SubscriptionEnrollmentVariation"
          },
          "uniqueItems": true
        }
      },
      "dependencies": {
        "advancedMode": {
          "oneOf": [
            {
              "properties": {
                "advancedMode": {
                  "enum": [false]
                },
                "settings": {
                  "title": "Settings",
                  "type": "object",
                  "properties": {
                    "defaultFrequency": {
                      "title": "Default frequency selection",
                      "$ref": "#/definitions/Frequency"
                    },
                    "offerType": {
                      "title": "Type",
                      "$ref": "#/definitions/OfferType"
                    }
                  },
                  "required": ["defaultFrequency", "offerType"]
                },
                "textCopy": {
                  "$ref": "#/definitions/SubscriptionEnrollmentTextCopies"
                },
                "styles": {
                  "$ref": "#/definitions/SubscriptionEnrollmentBasicStyles"
                }
              },
              "required": ["settings", "textCopy", "styles"]
            },
            {
              "properties": {
                "advancedMode": {
                  "enum": [true]
                },
                "markup": {
                  "type": "string",
                  "title": "HTML Source"
                },
                "css": {
                  "type": "string",
                  "title": "CSS Source"
                }
              },
              "required": ["advancedMode", "markup"]
            }
          ]
        }
      }
    }
  }
}
