{
  "$id": "deal-file@1",
  "title": "Deal file (deal-file@1)",
  "description": "A property deal produced by the Claude distressed-property-scout skill. Amounts in whole pounds, rates as decimals, dates as YYYY-MM-DD. Unknown fields are ignored.",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "schema": {
      "type": "string",
      "const": "deal-file@1"
    },
    "createdAt": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
        },
        {
          "type": "null"
        }
      ]
    },
    "source": {
      "type": [
        "string",
        "null"
      ]
    },
    "sheetUrl": {
      "anyOf": [
        {
          "type": "string",
          "format": "uri"
        },
        {
          "type": "null"
        }
      ]
    },
    "property": {
      "type": "object",
      "properties": {
        "address": {
          "type": "string",
          "minLength": 1
        },
        "postcode": {
          "type": [
            "string",
            "null"
          ]
        },
        "listingUrl": {
          "anyOf": [
            {
              "type": "string",
              "format": "uri"
            },
            {
              "type": "null"
            }
          ]
        },
        "type": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "terraced",
                "semi",
                "detached",
                "flat",
                "bungalow",
                "other"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "tenure": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "freehold",
                "leasehold",
                "share_of_freehold"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "leaseYearsLeft": {
          "anyOf": [
            {
              "type": "number",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "beds": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "baths": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "receptions": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "floorAreaM2": {
          "anyOf": [
            {
              "type": "number",
              "exclusiveMinimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "yearBuiltBand": {
          "type": [
            "string",
            "null"
          ]
        },
        "condition": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "minor_diy",
                "light_refurb",
                "full_refurb"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "standardConstruction": {
          "type": [
            "boolean",
            "null"
          ]
        }
      },
      "required": [
        "address"
      ]
    },
    "market": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "askingPrice": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                {
                  "type": "null"
                }
              ]
            },
            "originalAskingPrice": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                {
                  "type": "null"
                }
              ]
            },
            "firstListedDate": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "relisted": {
              "type": [
                "boolean",
                "null"
              ]
            },
            "reductions": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "date": {
                        "type": "string",
                        "format": "date",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                      },
                      "price": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "date",
                      "price"
                    ]
                  }
                },
                {
                  "type": "null"
                }
              ]
            },
            "localAvgWeeksOnMarket": {
              "anyOf": [
                {
                  "type": "number",
                  "exclusiveMinimum": 0
                },
                {
                  "type": "null"
                }
              ]
            },
            "localPctAskingAchieved": {
              "anyOf": [
                {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                },
                {
                  "type": "null"
                }
              ]
            },
            "distressSignals": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "probate",
                      "repossession",
                      "cash_buyers_only",
                      "chain_free",
                      "auction",
                      "relocation",
                      "motivated_seller",
                      "other"
                    ]
                  }
                },
                {
                  "type": "null"
                }
              ]
            },
            "notes": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "comparables": {
      "anyOf": [
        {
          "maxItems": 6,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "street": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "distanceMiles": {
                "anyOf": [
                  {
                    "type": "number",
                    "minimum": 0
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "typeBeds": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sizeM2": {
                "anyOf": [
                  {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "condition": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "soldPrice": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "soldDate": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "source": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "priceTrend": {
      "anyOf": [
        {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "year": {
                "type": "integer",
                "minimum": 1990,
                "maximum": 2100
              },
              "avgPrice": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "year",
              "avgPrice"
            ]
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "valuation": {
      "type": "object",
      "properties": {
        "basis": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "GDV",
                "MV"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "value": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "low": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "high": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "confidence": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "high",
                "medium",
                "low"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "rentPcm": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "lastSale": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "date": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "price": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "value"
      ]
    },
    "deal": {
      "type": "object",
      "properties": {
        "purchasePrice": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "ltv": {
          "anyOf": [
            {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            {
              "type": "null"
            }
          ]
        },
        "fees": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "agent": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "broker": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "solicitor": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "sdlt": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "valuation": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "architect": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "other": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "materials": {
          "anyOf": [
            {
              "maxItems": 8,
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "item": {
                    "type": "string",
                    "minLength": 1
                  },
                  "amount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "item",
                  "amount"
                ]
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "labour": {
          "anyOf": [
            {
              "maxItems": 8,
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "item": {
                    "type": "string",
                    "minLength": 1
                  },
                  "amount": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "item",
                  "amount"
                ]
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "bridging": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "monthlyRate": {
                  "anyOf": [
                    {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "months": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 36
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "mortgageRate": {
          "anyOf": [
            {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            },
            {
              "type": "null"
            }
          ]
        },
        "cashAvailable": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        },
        "tolerance": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "purchasePrice"
      ]
    },
    "score": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "inputs": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "timeOnMarket": {
                      "anyOf": [
                        {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 20
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "reductions": {
                      "anyOf": [
                        {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 20
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "askingVsComps": {
                      "anyOf": [
                        {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 20
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "nmliFeasibility": {
                      "anyOf": [
                        {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 25
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "distress": {
                      "anyOf": [
                        {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 10
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "valueAdd": {
                      "anyOf": [
                        {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 5
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                },
                {
                  "type": "null"
                }
              ]
            },
            "adjustment": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "points": {
                      "type": "number",
                      "minimum": -10,
                      "maximum": 10
                    },
                    "reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "points"
                  ]
                },
                {
                  "type": "null"
                }
              ]
            },
            "risks": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ]
            },
            "viewingChecklist": {
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                {
                  "type": "null"
                }
              ]
            },
            "openingOffer": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                {
                  "type": "null"
                }
              ]
            }
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "claudeCheck": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "maxOfferNMLI": {
              "type": [
                "number",
                "null"
              ]
            },
            "moneyLeftIn": {
              "type": [
                "number",
                "null"
              ]
            },
            "totalDownpayment": {
              "type": [
                "number",
                "null"
              ]
            },
            "scoreOutOf100": {
              "type": [
                "number",
                "null"
              ]
            }
          }
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "schema",
    "property",
    "valuation",
    "deal"
  ]
}
