{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/prro-cloud/json-schema/prro-cloud-invoice-schema.json",
  "title": "Invoice",
  "description": "Рахунок за один розрахунковий період.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/prro-cloud-billing-api-openapi.yml#/components/schemas/Invoice",
  "type": "object",
  "required": [
    "id",
    "period_start",
    "period_end",
    "amount",
    "currency",
    "status",
    "created_at"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Ідентифікатор рахунка."
    },
    "period_start": {
      "type": "string",
      "format": "date",
      "description": "Дата входить у період."
    },
    "period_end": {
      "type": "string",
      "format": "date",
      "description": "Дата входить у період."
    },
    "amount": {
      "$ref": "#/$defs/Money"
    },
    "currency": {
      "type": "string",
      "description": "Валюта рахунка за ISO 4217: UAH."
    },
    "status": {
      "type": "string",
      "enum": [
        "draft",
        "issued",
        "paid",
        "overdue"
      ],
      "description": "- `draft` — чернетка\n- `issued` — рахунок виставлено\n- `paid` — рахунок оплачено\n- `overdue` — рахунок прострочено"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Час створення рахунка."
    }
  },
  "$defs": {
    "Money": {
      "type": "string",
      "pattern": "^-?\\d+(\\.\\d{1,4})?$",
      "description": "Копійки, десятковий рядок (numeric(14,4)). Ніколи не число з рухомою комою."
    }
  }
}