{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "documentDate": {
      "description": "Data wystawienia dokumentu (YYYY-MM-DD). Gdy dokument podaje kilka dat, zwróć datę wystawienia.",
      "type": "string"
    },
    "documentNumber": {
      "description": "Wewnętrzny numer zamówienia (ZAM_W / ZS / ZO / „nasz nr dokumentu”).",
      "type": "string"
    },
    "subject": {
      "description": "Opis przedmiotu zamówienia lub projektu.",
      "type": "string"
    },
    "buyer": {
      "description": "Pełna nazwa firmy zamawiającej — sama nazwa podmiotu, bez osoby kontaktowej.",
      "type": "string"
    },
    "buyerTaxId": {
      "default": null,
      "description": "NIP firmy zamawiającej (same cyfry).",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "supplier": {
      "description": "Pełna nazwa firmy sprzedającej — sama nazwa podmiotu, bez osoby kontaktowej.",
      "type": "string"
    },
    "supplierTaxId": {
      "default": null,
      "description": "NIP firmy sprzedającej (same cyfry).",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "items": {
      "default": [],
      "description": "Pozycje zamówienia. Pozycje usługowe transportu / wysyłki NIE trafiają tutaj — ich wartość netto zwróć w polu deliveryCostNet.",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "fullName": {
            "description": "Nazwa i pełny opis elementu lub produktu. Nazwę rozbitą na kilka wierszy tej samej komórki scal w jeden ciąg oddzielony spacjami; nie dopisuj tu treści z sąsiednich kolumn.",
            "type": "string"
          },
          "dimension": {
            "default": null,
            "description": "Wymiar lub rozmiar elementu z osobnej kolumny albo pola wymiarowego — przepisz go stamtąd bez zmian. Gdy rozmiar występuje wyłącznie wewnątrz nazwy elementu, zostaw go w nazwie i zwróć null.",
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "unitPriceNet": {
            "default": null,
            "description": "Cena jednostkowa netto za dany element.",
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "quantity": {
            "default": null,
            "description": "Zamówiona ilość danego elementu.",
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "title": "PurchaseOrderItem"
      }
    },
    "totalNet": {
      "description": "Całkowita wartość netto zamówienia.",
      "type": "number"
    },
    "deliveryDate": {
      "default": null,
      "description": "Wskazany termin realizacji dostawy lub wysyłki (YYYY-MM-DD). Gdy dokument podaje termin opisowo, zwróć wynikającą z niego datę graniczną; gdy nie da się jej ustalić, zwróć null.",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "deliveryAddress": {
      "default": null,
      "description": "Adres dostawy zamówionych elementów.",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "deliveryContactName": {
      "default": null,
      "description": "Imię i nazwisko osoby kontaktowej w sprawie dostawy.",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "deliveryContactEmail": {
      "default": null,
      "description": "Adres e-mail osoby kontaktowej w sprawie dostawy.",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "deliveryContactPhone": {
      "default": null,
      "description": "Numer telefonu osoby kontaktowej w sprawie dostawy.",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "deliveryCostNet": {
      "description": "Koszt transportu / dostawy / wysyłki netto — osobna pozycja lub opłata typu „Transport”, „Usługa transportowa”, „Koszty wysyłki”, „Spedycja”. Taka pozycja NIE może równocześnie wystąpić w items. Gdy dokument nie podaje kosztu dostawy, pomiń to pole — nie zwracaj 0, bo 0 znaczy „dostawa bezpłatna”.",
      "type": "number",
      "minimum": 0
    },
    "deliveryCostDescription": {
      "default": null,
      "description": "Informacja o tym, kto ponosi koszty dostawy.",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "paymentTerms": {
      "default": null,
      "description": "Warunki i termin płatności za zamówienie.",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "invoiceEmail": {
      "default": null,
      "description": "Adres e-mail wskazany wprost jako adres do przesyłania faktur. Nie zwracaj tu adresu kontaktowego, adresu do dokumentów innego rodzaju ani ogólnego adresu firmy.",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "orderResponsibleName": {
      "default": null,
      "description": "Imię i nazwisko osoby odpowiedzialnej za zamówienie.",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "orderResponsiblePhone": {
      "default": null,
      "description": "Numer telefonu osoby odpowiedzialnej za zamówienie.",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "orderResponsibleEmail": {
      "default": null,
      "description": "Adres e-mail osoby odpowiedzialnej za zamówienie.",
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "title": "PurchaseOrder"
}
