{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/verkanto-eu/json-schema/verkanto-eu-api-invoice-view-schema.json",
  "title": "ApiInvoiceView",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/verkanto-eu-openapi.yml#/components/schemas/ApiInvoiceView",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "number": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "DRAFT",
        "SENT",
        "PAID",
        "OVERDUE",
        "CANCELLED",
        "REFUNDED"
      ]
    },
    "pdfStatus": {
      "type": "string",
      "enum": [
        "PENDING",
        "GENERATING",
        "READY",
        "FAILED"
      ]
    },
    "issueDate": {
      "type": "string",
      "format": "date"
    },
    "dueDate": {
      "type": "string",
      "format": "date"
    },
    "currency": {
      "type": "string"
    },
    "vatType": {
      "type": "string",
      "enum": [
        "B2B",
        "B2C",
        "EXEMPT"
      ]
    },
    "vatRate": {
      "type": "number"
    },
    "reverseCharge": {
      "type": "boolean"
    },
    "subtotal": {
      "type": "number"
    },
    "vatAmount": {
      "type": "number"
    },
    "total": {
      "type": "number"
    },
    "client": {
      "$ref": "#/$defs/ClientView"
    },
    "items": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ItemView"
      }
    },
    "createdVia": {
      "type": "string",
      "enum": [
        "UI",
        "API"
      ]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "links": {
      "$ref": "#/$defs/Links"
    },
    "notice": {
      "type": "string"
    }
  },
  "$defs": {
    "ClientView": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string"
        },
        "countryCode": {
          "type": "string"
        },
        "vatId": {
          "type": "string"
        },
        "vatValidated": {
          "type": "boolean"
        }
      }
    },
    "ItemView": {
      "type": "object",
      "properties": {
        "position": {
          "type": "integer",
          "format": "int32"
        },
        "description": {
          "type": "string"
        },
        "qty": {
          "type": "number"
        },
        "unitPrice": {
          "type": "number"
        }
      }
    },
    "Links": {
      "type": "object",
      "properties": {
        "self": {
          "type": "string"
        },
        "pdf": {
          "type": "string"
        }
      }
    }
  }
}