{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/doorloop/json-schema/doorloop-lease-transaction-schema.json",
  "title": "journalEntry",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/doorloop-lease-charges-api-openapi.yml#/components/schemas/leaseTransaction",
  "x-stoplight": {
    "id": "j92801xr8v1ta"
  },
  "allOf": [
    {
      "properties": {
        "lease": {
          "$ref": "#/$defs/mongoId"
        },
        "lines": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/leaseTransactionLine"
          }
        },
        "memo": {
          "type": "string",
          "maxLength": 1000
        },
        "reference": {
          "type": "string",
          "description": "If not provided one will be generated by the server",
          "maxLength": 50
        },
        "date": {
          "type": "string",
          "description": "Format: YYYY-MM-DD"
        },
        "batch": {
          "type": "string"
        }
      },
      "required": [
        "lease",
        "lines",
        "date"
      ]
    }
  ],
  "type": "object",
  "$defs": {
    "leaseTransactionLine": {
      "title": "leaseTransactionLine",
      "x-stoplight": {
        "id": "fc1wegnped57j"
      },
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/mongoId"
        },
        "amount": {
          "type": "number"
        },
        "account": {
          "type": "string",
          "description": "References the Account Id for this line."
        },
        "memo": {
          "type": "string",
          "maxLength": 1000
        },
        "balance": {
          "type": "number",
          "readOnly": true,
          "description": "Remaining unpaid amount on this line. `amount` is the original charged amount, so the amount paid is `amount - balance`."
        }
      },
      "required": [
        "amount",
        "account"
      ]
    },
    "mongoId": {
      "type": "string",
      "title": "mongoId",
      "x-stoplight": {
        "id": "40j7qlmpihfdj"
      },
      "pattern": "/^[a-f\\d]{24}$/i"
    }
  }
}