{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.pybara.com/donate-widget/options.schema.json",
  "title": "PybaraDonate.init() options",
  "description": "Options for PybaraDonate.init() / new DonationWidget() in @pybara/donate-widget. The widget stays hidden until the site is verified in Pybara Wallet and its owner has accepted the widget terms.",
  "type": "object",
  "additionalProperties": false,
  "required": ["target", "recipientPrincipal", "siteUrl", "siteName"],
  "properties": {
    "target": {
      "type": "string",
      "description": "CSS selector of the mount point, e.g. '#pybara-donate'. (An HTMLElement is also accepted in JS but is not expressible in JSON.)"
    },
    "recipientPrincipal": {
      "type": "string",
      "description": "Recipient's principal ID — the wallet that receives donations."
    },
    "siteUrl": {
      "type": "string",
      "format": "uri",
      "description": "Site origin, e.g. 'https://example.com'. Must match the site verified in Pybara Wallet; it is the registry key in the recipient registry."
    },
    "siteName": {
      "type": "string",
      "description": "Display name for the site, e.g. 'Example Charity'."
    },
    "presetAmounts": {
      "type": "array",
      "items": { "type": "number", "minimum": 0.5 },
      "maxItems": 6,
      "default": [5, 10, 25, 50],
      "description": "Preset donation amounts in the display currency."
    },
    "allowCustom": {
      "type": "boolean",
      "default": true,
      "description": "Allow a custom amount input."
    },
    "allowRecurring": {
      "type": "boolean",
      "default": true,
      "description": "Show the recurring donation option."
    },
    "defaultFrequency": {
      "enum": ["weekly", "monthly", "yearly", "every2min"],
      "default": "monthly",
      "description": "Preselected recurring frequency. 'every2min' is a test frequency."
    },
    "defaultDurationInMonths": {
      "enum": [3, 6, 12, 24, null],
      "default": 12,
      "description": "Preselected recurring duration in months; null means no end date."
    },
    "tokens": {
      "type": "array",
      "items": { "type": "string" },
      "default": ["ckUSDC", "ckUSDT", "ckBTC", "ckETH", "ICP"],
      "description": "Token symbols offered to the donor."
    },
    "title": {
      "type": "string",
      "description": "Widget title, above the amount selector."
    },
    "description": {
      "type": "string",
      "description": "Text below the title."
    },
    "thankYouMessage": {
      "type": "string",
      "description": "Message shown after a successful donation."
    },
    "thankYouRedirectUrl": {
      "type": "string",
      "format": "uri",
      "description": "URL the donor is sent to after a successful donation."
    },
    "buttonLabel": {
      "type": "string",
      "description": "Donate button label. Left out, it says Donate in the widget's language."
    },
    "primaryColor": {
      "type": "string",
      "pattern": "^#[0-9a-fA-F]{6}$",
      "default": "#7c3aed",
      "description": "Accent color (hex) for buttons, selected states and links. Match the site's accent."
    },
    "theme": {
      "enum": ["light", "dark", "auto"],
      "default": "light",
      "description": "'auto' samples the surrounding page background at mount. Prefer it unless the site fixes its own scheme."
    },
    "currency": {
      "type": "string",
      "pattern": "^[A-Za-z]{3}$",
      "default": "USD",
      "description": "Display currency (ISO 4217). Amounts are shown in it and converted to USD for payment."
    },
    "locale": {
      "type": "string",
      "description": "Locale override (e.g. 'fr'); auto-detected by default."
    },
    "staging": {
      "type": "boolean",
      "default": false,
      "description": "Use the staging environment. Never set on a live site."
    },
    "debug": {
      "type": "boolean",
      "default": false,
      "description": "Enable debug logging."
    },
    "fontUrl": {
      "type": "string",
      "description": "Absolute or relative URL of a self-hosted woff2 file. When omitted, no font is loaded."
    },
    "siteCountry": {
      "type": "string",
      "pattern": "^[A-Za-z]{2}$",
      "description": "Site base country (ISO 3166-1 alpha-2)."
    },
    "donorIsAnonymous": {
      "type": "boolean",
      "description": "Hide donor name/details from recipient-facing displays."
    },
    "donorMessage": { "type": "string", "description": "Free-text message from donor to recipient." },
    "donorFirstName": { "type": "string" },
    "donorLastName": { "type": "string" },
    "donorEmail": {
      "type": "string",
      "format": "email",
      "description": "Donor's email, stored for the receipt feature; never publicly displayed."
    },
    "donorCompany": { "type": "string" },
    "donorCountry": { "type": "string" },
    "donorAddressLine1": { "type": "string", "description": "Donor mailing address — all address fields are required together when provided." },
    "donorAddressLine2": { "type": "string" },
    "donorAddressCity": { "type": "string" },
    "donorAddressState": { "type": "string" },
    "donorAddressPostalCode": { "type": "string" },
    "donorAddressCountry": { "type": "string" },
    "donorTosVersion": { "type": "string", "description": "TOS version the donor accepted, e.g. '1-0'." },
    "donorTosAcceptedAt": { "type": "string", "format": "date-time", "description": "ISO 8601 UTC timestamp of donor TOS acceptance." },
    "recipientTosVersion": { "type": "string", "description": "TOS version the site operator accepted." },
    "recipientTosAcceptedAt": { "type": "string", "format": "date-time", "description": "ISO 8601 UTC timestamp of recipient TOS acceptance." },
    "pluginVersion": { "type": "string", "description": "Plugin/integration version forwarding this donation, e.g. '1.2.0'." },
    "onSuccess": { "description": "Function, not expressible in JSON — callback after a successful donation, called with the DonationResult." },
    "onError": { "description": "Function, not expressible in JSON — callback on donation error, called with an Error." },
    "onClose": { "description": "Function, not expressible in JSON — callback when the widget is closed or cancelled." }
  }
}
