{
  "$defs": {
    "DueDate": {
      "description": "DueDate contains an amount that should be paid by the given date.",
      "properties": {
        "amount": {
          "$ref": "https://gobl.org/draft-0/num/amount",
          "description": "How much needs to be paid by the date.",
          "title": "Amount"
        },
        "currency": {
          "$ref": "https://gobl.org/draft-0/currency/code",
          "description": "If different from the parent document's base currency.",
          "title": "Currency"
        },
        "date": {
          "$ref": "https://gobl.org/draft-0/cal/date",
          "description": "When the payment is due.",
          "title": "Date"
        },
        "notes": {
          "description": "Other details to take into account for the due date.",
          "title": "Notes",
          "type": "string"
        },
        "percent": {
          "$ref": "https://gobl.org/draft-0/num/percentage",
          "description": "Percentage of the total that should be paid by the date.",
          "title": "Percent"
        }
      },
      "required": [
        "date",
        "amount"
      ],
      "type": "object"
    },
    "Terms": {
      "description": "Terms defines when we expect the customer to pay, or have paid, for the contents of the document.",
      "properties": {
        "detail": {
          "description": "Text detail of the chosen payment terms.",
          "title": "Detail",
          "type": "string"
        },
        "due_dates": {
          "description": "Set of dates for agreed payments.",
          "items": {
            "$ref": "#/$defs/DueDate"
          },
          "title": "Due Dates",
          "type": "array"
        },
        "key": {
          "$ref": "https://gobl.org/draft-0/cbc/key",
          "description": "Type of terms to be applied.",
          "oneOf": [
            {
              "const": "",
              "description": "Not yet defined",
              "title": "NA"
            },
            {
              "const": "end-of-month",
              "description": "End of month",
              "title": "End of Month"
            },
            {
              "const": "due-date",
              "description": "Due on a specific date",
              "title": "Due Date"
            },
            {
              "const": "deferred",
              "description": "Deferred until after the due date",
              "title": "Deferred"
            },
            {
              "const": "proximo",
              "description": "Month after the present",
              "title": "Proximo"
            },
            {
              "const": "instant",
              "description": "On receipt of invoice",
              "title": "Instant"
            },
            {
              "const": "elective",
              "description": "Chosen by the buyer",
              "title": "Elective"
            },
            {
              "const": "pending",
              "description": "Seller to advise buyer in separate transaction",
              "title": "Pending"
            },
            {
              "const": "advanced",
              "description": "Payment made in advance",
              "title": "Advanced"
            },
            {
              "const": "delivery",
              "description": "Payment on Delivery",
              "title": "Delivery"
            }
          ],
          "title": "Key"
        },
        "notes": {
          "description": "Description of the conditions for payment.",
          "title": "Notes",
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "$id": "https://gobl.org/draft-0/pay/terms",
  "$ref": "#/$defs/Terms",
  "$schema": "https://json-schema.org/draft/2020-12/schema"
}