{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/doorloop/json-schema/doorloop-vendor-transaction-schema.json",
  "title": "vendorTransaction",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/doorloop-vendor-bills-api-openapi.yml#/components/schemas/vendorTransaction",
  "x-stoplight": {
    "id": "1fqjs8q8lcqqh"
  },
  "type": "object",
  "properties": {
    "id": {
      "$ref": "#/$defs/mongoId"
    },
    "vendor": {
      "$ref": "#/$defs/mongoId"
    },
    "lines": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/expenseTransactionLine"
      }
    },
    "date": {
      "type": "string",
      "description": "Format: YYYY-MM-DD"
    },
    "dueDate": {
      "type": "string",
      "description": "Format: YYYY-MM-DD"
    },
    "memo": {
      "type": "string",
      "maxLength": 1000
    },
    "reference": {
      "type": "string",
      "description": "If not provided wil be generated by the server.",
      "maxLength": 255
    },
    "batch": {
      "type": "string"
    },
    "totalAmount": {
      "type": "number",
      "description": "Read Only. Calculated by the server."
    },
    "totalBalance": {
      "type": "number",
      "description": "Read Only. Calculated by the server."
    }
  },
  "required": [
    "vendor",
    "lines",
    "date",
    "dueDate"
  ],
  "$defs": {
    "expenseTransactionLine": {
      "title": "expenseTransactionLine",
      "x-stoplight": {
        "id": "i2oe5ol30qri6"
      },
      "type": "object",
      "properties": {
        "id": {
          "$ref": "#/$defs/mongoId"
        },
        "amount": {
          "type": "number"
        },
        "account": {
          "$ref": "#/$defs/mongoId"
        },
        "memo": {
          "type": "string",
          "maxLength": 1000
        },
        "linkedToResourceType": {
          "type": "string",
          "description": "At the monent, only \"property\" is supported",
          "enum": [
            "property"
          ]
        },
        "linkedToResourceId": {
          "type": "string",
          "description": "The Property Id for this line."
        },
        "balance": {
          "description": "Read Only",
          "type": "number"
        }
      },
      "required": [
        "account",
        "linkedToResourceType",
        "linkedToResourceId"
      ]
    },
    "mongoId": {
      "type": "string",
      "title": "mongoId",
      "x-stoplight": {
        "id": "40j7qlmpihfdj"
      },
      "pattern": "/^[a-f\\d]{24}$/i"
    }
  }
}