{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://schema.traceoriginal.com/trace-original-deferment-guarantee-en-schema-v1.2.json",
  "title": "trace:original Deferment Guarantee Schema v1.2",
  "allOf": [{"$ref": "https://schema.traceoriginal.com/trace-original-agreement-en-schema-v1.2.json"}],
  "definitions": {
    "Guarantee": {
      "type": "object",
      "properties": {
        "Deferment Approval Number": { "oneOf": [{"type": "string"}, {"type": "number"}], "position": 1 },
        "Name of Guarantor": { "type": "string", "position": 2 },
        "Address of Guarantor": {
          "type": "object",
          "properties": {
            "Line 1": { "oneOf": [{"type": "string"}, {"type": "number"}], "position": 1 },
            "Line 2": { "oneOf": [{"type": "string"}, {"type": "number"}], "position": 2 },
            "Line 3": { "oneOf": [{"type": "string"}, {"type": "number"}], "position": 3 },
            "Postcode": { "oneOf": [{"type": "string"}, {"type": "number"}], "position": 4 },
            "Country": { "type": "string", "position": 5 },
            "Telephone number": { "oneOf": [{"type": "string"}, {"type": "number"}], "position": 6 }
          },
          "position": 3
        },
        "Guarantor's reference number": { "oneOf": [{"type": "string"}, {"type": "number"}], "position": 4 },
        "Applicant details": {
          "type": "object",
          "properties": {
            "Name of applicant": { "type": "string", "position": 1 },
            "Address of applicant": {
              "type": "object",
              "properties": {
                "Line 1": { "oneOf": [{"type": "string"}, {"type": "number"}], "position": 1 },
                "Line 2": { "oneOf": [{"type": "string"}, {"type": "number"}], "position": 2 },
                "Line 3": { "oneOf": [{"type": "string"}, {"type": "number"}], "position": 3 },
                "Postcode": { "oneOf": [{"type": "string"}, {"type": "number"}], "position": 4 },
                "Country": { "type": "string", "position": 5 }
              },
              "position": 2
            },
            "Name of Guarantor": { "type": "string", "position": 3  },
            "Amount in words": { "type": "string", "position": 4  },
            "Amount in figures (GBP)": { "type": "number", "position": 5  },
            "The guarantee shall commence on": { "oneOf": [{"type": "string"}, {"type": "number"}], "position": 6 }
          },
          "position": 5
        },
        "Replacing earlier guarantee(s)": {
          "type": "object",
          "properties": {
            "Such sums are or were deferred during the continuance of the guarantee(s) scheduled below in the total amount of (GBP)": { "oneOf": [{"type": "string"}, {"type": "number"}], "position": 1 },
            "Schedule of earlier guarantees": {
              "type": "array",
              "items": {
                "Dated": { "oneOf": [{"type": "string"}, {"type": "number"}], "position": 1 },
                "Name of Guarantor": { "type": "string",  "position": 2 },
                "In the amount of (GBP)": { "oneOf": [{"type": "string"}, {"type": "number"}], "position": 3 }
              },
              "position": 2
            },
            "Total amount of earlier guarantee(s) (GBP)": { "oneOf": [{"type": "string"}, {"type": "number"}], "position": 3 }
          },
          "position": 6
        },
        "Supplementing an existing guarantee": {
          "type": "object",
          "properties": {
            "This guarantee supplements the guarantee dated": { "oneOf": [{"type": "string"}, {"type": "number"}], "position": 1 },
            "And shall remain in force": { "oneOf": [{"type": "string"}, {"type": "number"}], "position": 2 }
          },
          "position": 7
        },
        "Guarantor": {
          "type": "object",
          "properties": {
            "I confirm the information I have given is correct":{ "oneOf": [{"type": "string"}, {"type": "boolean"}], "position": 1 },
            "For (Name of Guarantor)": { "type": "string", "position": 2 },
            "Status of signatory": { "type": "string", "position": 3 },
            "Is this guarantee executed in Scotland": { "oneOf": [{"type": "string"}, {"type": "boolean"}], "position": 4 }
          },
          "position": 8
        }
      },
      "additionalItems": false,
      "minProperties": 1
    }
  },
  "properties": {
    "Content": {
      "type": "object",
      "properties": {
        "Agreement terms": {
          "$ref": "#/definitions/Guarantee"
        }
      }
    },
    "Amendments": {
      "type": "array",
      "items": {
        "Content": {
          "anyOf": [
            {
              "$ref": "#/definitions/Guarantee"
            },
            {
              "type": "string"
            }
          ]
        }
      }
    }
  }
}
