{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/altoviz-com/json-schema/altoviz-com-purchase-invoice-schema.json",
  "title": "PurchaseInvoice",
  "description": "Purchase invoice",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/altoviz-com-purchaseinvoices-api-openapi.yml#/components/schemas/PurchaseInvoice",
  "type": "object",
  "properties": {
    "date": {
      "type": "string",
      "description": "Date",
      "format": "date"
    },
    "id": {
      "type": "integer",
      "description": "Expense ID",
      "format": "int32",
      "readOnly": true
    },
    "notes": {
      "type": [
        "string",
        "null"
      ],
      "description": "Notes"
    },
    "pdfUrl": {
      "type": [
        "string",
        "null"
      ],
      "description": "Pdf url",
      "readOnly": true
    },
    "reference": {
      "type": [
        "string",
        "null"
      ],
      "description": "Reference"
    },
    "region": {
      "$ref": "#/$defs/VatRegion"
    },
    "status": {
      "$ref": "#/$defs/ExpenseStatus"
    },
    "subject": {
      "type": [
        "string",
        "null"
      ],
      "description": "Subject"
    },
    "supplier": {
      "$ref": "#/$defs/Supplier"
    },
    "taxIncludedAmount": {
      "type": "number",
      "description": "Tax included amount",
      "format": "double"
    },
    "vatReverseCharge": {
      "type": "boolean",
      "description": "Vat reverse charge"
    }
  },
  "additionalProperties": false,
  "$defs": {
    "AddressFields": {
      "type": "object",
      "properties": {
        "city": {
          "type": [
            "string",
            "null"
          ]
        },
        "countryIso": {
          "type": [
            "string",
            "null"
          ]
        },
        "countryName": {
          "type": [
            "string",
            "null"
          ],
          "readOnly": true
        },
        "formattedAddress": {
          "type": [
            "string",
            "null"
          ],
          "readOnly": true
        },
        "inlineAddress": {
          "type": [
            "string",
            "null"
          ],
          "readOnly": true
        },
        "street": {
          "type": [
            "string",
            "null"
          ]
        },
        "zipcode": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "additionalProperties": false
    },
    "CompanyInfo": {
      "type": "object",
      "properties": {
        "effectiveElectronicAddress": {
          "type": [
            "string",
            "null"
          ]
        },
        "electronicAddress": {
          "type": [
            "string",
            "null"
          ]
        },
        "siret": {
          "type": [
            "string",
            "null"
          ]
        },
        "vatNumber": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "additionalProperties": false
    },
    "ExpenseStatus": {
      "enum": [
        "Done",
        "Pending",
        "Paid"
      ],
      "type": "string"
    },
    "PaymentMethod": {
      "enum": [
        "Transfer",
        "Order",
        "Check",
        "Cash",
        "Card",
        "Bill",
        "Usec",
        "Other"
      ],
      "type": "string"
    },
    "Supplier": {
      "type": "object",
      "properties": {
        "active": {
          "type": "boolean",
          "description": "Whether the supplier is active"
        },
        "address": {
          "$ref": "#/$defs/AddressFields"
        },
        "cellPhone": {
          "type": [
            "string",
            "null"
          ],
          "description": "Cell phone number"
        },
        "companyInformations": {
          "$ref": "#/$defs/CompanyInfo"
        },
        "createdAt": {
          "type": [
            "string",
            "null"
          ],
          "description": "Created date",
          "format": "date-time"
        },
        "createdById": {
          "type": [
            "string",
            "null"
          ],
          "description": "Created by user ID"
        },
        "defaultPaymentMethod": {
          "$ref": "#/$defs/PaymentMethod"
        },
        "email": {
          "type": [
            "string",
            "null"
          ],
          "description": "Email"
        },
        "firstName": {
          "type": [
            "string",
            "null"
          ],
          "description": "First name"
        },
        "id": {
          "type": "integer",
          "description": "Supplier ID",
          "format": "int32",
          "readOnly": true
        },
        "internalId": {
          "type": [
            "string",
            "null"
          ],
          "description": "Internal Id"
        },
        "internalNotes": {
          "type": [
            "string",
            "null"
          ],
          "description": "Internal notes"
        },
        "lastName": {
          "type": [
            "string",
            "null"
          ],
          "description": "Last name"
        },
        "name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Company name"
        },
        "number": {
          "type": [
            "string",
            "null"
          ],
          "description": "Number"
        },
        "phone": {
          "type": [
            "string",
            "null"
          ],
          "description": "Phone number"
        },
        "title": {
          "type": [
            "string",
            "null"
          ],
          "description": "Title"
        },
        "updatedAt": {
          "type": [
            "string",
            "null"
          ],
          "description": "Updated date",
          "format": "date-time"
        },
        "updatedById": {
          "type": [
            "string",
            "null"
          ],
          "description": "Updated by user ID"
        }
      },
      "additionalProperties": false,
      "description": "Supplier"
    },
    "VatRegion": {
      "enum": [
        "FR",
        "EU",
        "IE",
        "DOM",
        "Corse",
        "Monaco"
      ],
      "type": "string"
    }
  }
}