{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "e-İrsaliye — json2ubl-ts SimpleDespatchInput",
  "description": "e-İrsaliye girdisi (SimpleDespatchInput). POST /v1/documents gövdesindeki `document` alanının şeması; documentType: IRSALIYE. additionalProperties:false sunucuda uygulanır: tanınmayan alan (ör. yazım hatası) 400 DOCUMENT_INVALID ile reddedilir, issues[].field alanın yolunu verir. uuid Belgeniz API'de zorunludur.",
  "$comment": "json2ubl-ts 5.3.1 tip tanımından (dist/index.d.ts, SimpleDespatchInput) üretildi. Kaynak: https://github.com/rahat-fatura/json2ubl-ts",
  "x-json2ubl-ts-version": "5.3.1",
  "x-json2ubl-ts-type": "SimpleDespatchInput",
  "$ref": "#/definitions/SimpleDespatchInput",
  "definitions": {
    "SimpleDespatchInput": {
      "type": "object",
      "properties": {
        "sender": {
          "type": "object",
          "properties": {
            "taxNumber": {
              "type": "string",
              "description": "Vergi kimlik numarası (10 hane VKN veya 11 hane TCKN) — zorunlu"
            },
            "name": {
              "type": "string",
              "description": "Firma adı veya kişi adı soyadı — zorunlu"
            },
            "taxOffice": {
              "type": "string",
              "description": "Vergi dairesi — VKN için zorunlu, TCKN için opsiyonel"
            },
            "address": {
              "type": "string",
              "description": "Adres — zorunlu"
            },
            "district": {
              "type": "string",
              "description": "İlçe — zorunlu"
            },
            "city": {
              "type": "string",
              "description": "İl — zorunlu"
            },
            "country": {
              "type": "string",
              "description": "Ülke — varsayılan: \"Türkiye\""
            },
            "zipCode": {
              "type": "string",
              "description": "Posta kodu — varsayılan: \"00000\""
            },
            "phone": {
              "type": "string",
              "description": "Telefon"
            },
            "email": {
              "type": "string",
              "description": "E-posta"
            },
            "website": {
              "type": "string",
              "description": "Web sitesi"
            },
            "identifications": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/SimplePartyIdentification"
              },
              "description": "Ek taraf kimlik tanımlamaları (ör: MERSISNO, TICARETSICILNO)"
            },
            "alias": {
              "type": "string",
              "description": "e-Fatura posta kutusu etiketi (ör: \"urn:mail:defaultpk@firma.com.tr\").\n\n⚠️ **Bu alan üretilen UBL-TR Invoice XML'ine YAZILMAZ — bilerek.**\n\nEtiket, faturanın kendisine değil **zarfa** (GİB e-Fatura Paketi SBDH: `<sender identifier=\"...\" alias=\"urn:mail:...\"/>` / `<receiver identifier=\"...\" alias=\"...\"/>`) aittir. GİB UBL-TR 1.2.1 `PartyType`'ında etiket için tanımlı bir eleman yoktur; `cbc:EndpointID` şemada bulunsa da UBL-TR kılavuzunda bu amaçla kullanılmaz, dolayısıyla oraya yazmak standart dışı olurdu. e-Arşiv faturalarında etiket kavramı hiç yoktur.\n\nZarf üretimi kütüphanenin sorumluluk sınırının dışındadır (aynı sınır UBLExtensions/imza için de geçerlidir — bkz. B-101). Etiketi entegratöre gönderirken zarf tarafında siz taşımalısınız; alan burada yalnızca çağıranın veri modelini tek yerde tutabilmesi için durur (B-102 denetimi)."
            }
          },
          "additionalProperties": false,
          "description": "Gönderici — `DespatchSupplierParty` İsteğe bağlı: verilmeyen alanlar firmanın varsayılan göndericisinden tamamlanır; vergi numarası verilirse firmanınkiyle aynı olmalı."
        },
        "customer": {
          "$ref": "#/definitions/SimplePartyInput",
          "description": "Alıcı — `DeliveryCustomerParty`"
        },
        "shipment": {
          "$ref": "#/definitions/SimpleShipmentInput",
          "description": "Sevkiyat bilgileri — zorunlu"
        },
        "lines": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/SimpleDespatchLineInput"
          },
          "description": "Kalemler — en az bir tane"
        },
        "id": {
          "type": "string",
          "description": "İrsaliye numarası (16 hane). Verilmezse çağıran/seri motoru doldurur."
        },
        "uuid": {
          "type": "string",
          "description": "ETTN. Verilmezse üretilir. Belgeniz API'de zorunludur: her belge için yeni bir UUID üretin."
        },
        "datetime": {
          "type": "string",
          "description": "Düzenleme anı — SDK `issueDate` + `issueTime`e böler. Varsayılan: şimdi."
        },
        "type": {
          "type": "string",
          "description": "İrsaliye tipi: \"SEVK\" | \"MATBUDAN\" — varsayılan: \"SEVK\""
        },
        "profile": {
          "type": "string",
          "description": "Profil: \"TEMELIRSALIYE\" | \"HKSIRSALIYE\" | \"IDISIRSALIYE\" — varsayılan: \"TEMELIRSALIYE\""
        },
        "notes": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Notlar"
        },
        "orderReferences": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/SimpleDespatchOrderReferenceInput"
          },
          "description": "Sipariş referansları (0..n)"
        },
        "additionalDocuments": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/SimpleDespatchAdditionalDocumentInput"
          },
          "description": "Ek belgeler — MATBUDAN'da zorunlu"
        },
        "despatchContactName": {
          "type": "string",
          "description": "Teslim eden kişinin adı — `DespatchSupplierParty/DespatchContact/Name`"
        },
        "buyerCustomer": {
          "$ref": "#/definitions/SimplePartyInput",
          "description": "Alıcı müşteri — teslimat tarafından FARKLIYSA (`BuyerCustomerParty`)"
        },
        "sellerSupplier": {
          "$ref": "#/definitions/SimplePartyInput",
          "description": "Satıcı — göndericiden FARKLIYSA (`SellerSupplierParty`)"
        },
        "originator": {
          "$ref": "#/definitions/SimplePartyInput",
          "description": "Sipariş veren — komisyoncu/özel senaryo (`OriginatorCustomerParty`)"
        }
      },
      "required": [
        "customer",
        "shipment",
        "lines",
        "uuid"
      ],
      "additionalProperties": false,
      "description": "Basitleştirilmiş e-İrsaliye girişi."
    },
    "SimplePartyInput": {
      "type": "object",
      "properties": {
        "taxNumber": {
          "type": "string",
          "description": "Vergi kimlik numarası (10 hane VKN veya 11 hane TCKN) — zorunlu"
        },
        "name": {
          "type": "string",
          "description": "Firma adı veya kişi adı soyadı — zorunlu"
        },
        "taxOffice": {
          "type": "string",
          "description": "Vergi dairesi — VKN için zorunlu, TCKN için opsiyonel"
        },
        "address": {
          "type": "string",
          "description": "Adres — zorunlu"
        },
        "district": {
          "type": "string",
          "description": "İlçe — zorunlu"
        },
        "city": {
          "type": "string",
          "description": "İl — zorunlu"
        },
        "country": {
          "type": "string",
          "description": "Ülke — varsayılan: \"Türkiye\""
        },
        "zipCode": {
          "type": "string",
          "description": "Posta kodu — varsayılan: \"00000\""
        },
        "phone": {
          "type": "string",
          "description": "Telefon"
        },
        "email": {
          "type": "string",
          "description": "E-posta"
        },
        "website": {
          "type": "string",
          "description": "Web sitesi"
        },
        "identifications": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/SimplePartyIdentification"
          },
          "description": "Ek taraf kimlik tanımlamaları (ör: MERSISNO, TICARETSICILNO)"
        },
        "alias": {
          "type": "string",
          "description": "e-Fatura posta kutusu etiketi (ör: \"urn:mail:defaultpk@firma.com.tr\").\n\n⚠️ **Bu alan üretilen UBL-TR Invoice XML'ine YAZILMAZ — bilerek.**\n\nEtiket, faturanın kendisine değil **zarfa** (GİB e-Fatura Paketi SBDH: `<sender identifier=\"...\" alias=\"urn:mail:...\"/>` / `<receiver identifier=\"...\" alias=\"...\"/>`) aittir. GİB UBL-TR 1.2.1 `PartyType`'ında etiket için tanımlı bir eleman yoktur; `cbc:EndpointID` şemada bulunsa da UBL-TR kılavuzunda bu amaçla kullanılmaz, dolayısıyla oraya yazmak standart dışı olurdu. e-Arşiv faturalarında etiket kavramı hiç yoktur.\n\nZarf üretimi kütüphanenin sorumluluk sınırının dışındadır (aynı sınır UBLExtensions/imza için de geçerlidir — bkz. B-101). Etiketi entegratöre gönderirken zarf tarafında siz taşımalısınız; alan burada yalnızca çağıranın veri modelini tek yerde tutabilmesi için durur (B-102 denetimi)."
        }
      },
      "required": [
        "taxNumber",
        "name",
        "address",
        "district",
        "city"
      ],
      "additionalProperties": false,
      "description": "Taraf (gönderici/alıcı) basit girişi"
    },
    "SimplePartyIdentification": {
      "type": "object",
      "properties": {
        "schemeId": {
          "type": "string",
          "description": "Tanımlama şema tipi (ör: \"MERSISNO\", \"TICARETSICILNO\", \"HIZMETNO\", \"MUSTERINO\", \"TESISATNO\")"
        },
        "value": {
          "type": "string",
          "description": "Tanımlama değeri"
        }
      },
      "required": [
        "schemeId",
        "value"
      ],
      "additionalProperties": false,
      "description": "Ek taraf kimlik tanımlama"
    },
    "SimpleShipmentInput": {
      "type": "object",
      "properties": {
        "actualDespatchDatetime": {
          "type": "string",
          "description": "Fiili sevk anı — `ActualDespatchDate` + `ActualDespatchTime`. `datetime` gibi TEK alandır, SDK böler.\n\n🔴 Fiili sevk anı, düzenleme anından ÖNCE OLAMAZ (Uygulama Kılavuzu §10). İleri tarih serbesttir. Tek istisna MATBUDAN dönüşümüdür."
        },
        "deliveryAddress": {
          "$ref": "#/definitions/SimpleDeliveryAddressInput",
          "description": "Teslimat adresi — zorunlu (`DespatchAddressCheck`: ilçe+il+ülke+posta kodu)"
        },
        "drivers": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/SimpleDriverInput"
          },
          "description": "Şoförler. 🔴 Şoför VEYA taşıyıcıdan en az biri ZORUNLU (`DespatchCarrierDriverCheck`).\n\nÇoklu araçta şoförler araçlara DAĞITILMAZ; tamamı ilk `cac:ShipmentStage`e yazılır. Gerekçe (kılavuzda eşleşme kuralı YOK + GİB örneği iki şoförü tek aşamada gösteriyor): `ubl/components/delivery.ts` → `buildVehicleStages`."
        },
        "carrier": {
          "$ref": "#/definitions/SimplePartyInput",
          "description": "Taşıyıcı firma — `Delivery/CarrierParty`. Şoför yoksa zorunlu."
        },
        "licensePlates": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/SimpleLicensePlateInput"
          },
          "description": "Araç (ÇEKİCİ) plakaları — en az biri ZORUNLU (yukarıdaki nota bkz.). Her kayıt BİR ARAÇTIR ve ayrı bir `cac:ShipmentStage` üretir; çoklu araç böyle bildirilir.\n\n⚠️ Dorse buraya YAZILMAZ — `trailerPlates` kullanın."
        },
        "trailerPlates": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/SimpleTrailerPlateInput"
          },
          "description": "Dorse/römork plakaları (0..n) — gerekçe `SimpleTrailerPlateInput`ta."
        },
        "shipmentId": {
          "type": "string",
          "description": "Sevkiyat numarası — `Shipment/ID`"
        },
        "goodsValue": {
          "type": "number",
          "description": "Taşınan malın beyan değeri — irsaliyedeki TEK tutar alanı"
        },
        "goodsValueCurrency": {
          "type": "string",
          "description": "Beyan değerinin para birimi — varsayılan: \"TRY\""
        }
      },
      "required": [
        "actualDespatchDatetime",
        "deliveryAddress"
      ],
      "additionalProperties": false,
      "description": "Sevkiyat bilgileri — `cac:Shipment` (XSD'de zorunlu)."
    },
    "SimpleDeliveryAddressInput": {
      "type": "object",
      "properties": {
        "address": {
          "type": "string",
          "description": "Açık adres — zorunlu"
        },
        "district": {
          "type": "string",
          "description": "İlçe — zorunlu (`CitySubdivisionName`)"
        },
        "city": {
          "type": "string",
          "description": "İl — zorunlu (`CityName`)"
        },
        "country": {
          "type": "string",
          "description": "Ülke — varsayılan: \"Türkiye\""
        },
        "zipCode": {
          "type": "string",
          "description": "Posta kodu — zorunlu. 🔴 Şematron TR biçimini KOŞULSUZ dayatır (`^((0[1-9])|([1-7][0-9])|(8[0-1]))[0-9]{3}$`), ülke ayrımı YAPMAZ. Yurt dışı teslimat adresi bu kapıyı geçemez — ihracat e-İrsaliyesi bu sürümde KAPSAM DIŞIDIR."
        }
      },
      "required": [
        "address",
        "district",
        "city",
        "zipCode"
      ],
      "additionalProperties": false,
      "description": "Teslimat adresi — fatura `SimplePartyInput` adres alanlarıyla aynı dilde."
    },
    "SimpleDriverInput": {
      "type": "object",
      "properties": {
        "firstName": {
          "type": "string",
          "description": "Ad — zorunlu"
        },
        "familyName": {
          "type": "string",
          "description": "Soyad — zorunlu"
        },
        "nationalityId": {
          "type": "string",
          "description": "TCKN — zorunlu. Yabancı uyruklu şoförde pasaport numarası (e-İrsaliye Uygulama Kılavuzu §15.34: dolgu numara YASAK, UETDS bildirimiyle eşleşmek zorunda)."
        }
      },
      "required": [
        "firstName",
        "familyName",
        "nationalityId"
      ],
      "additionalProperties": false,
      "description": "Şoför — `Shipment/ShipmentStage/DriverPerson`.\n\n🔴 Schematron `DespatchCarrierDriverCheck` (Common:765-770): şoför VERİLİRSE ad, soyad ve kimlik numarasının ÜÇÜ DE dolu olmalıdır. ⚠️ Kural `string(node-set)` kullandığı için GİB yalnız İLK şoförü denetler; çoklu şoförde ikincinin boş alanı şematrondan geçer → doğrulama BİZİM işimiz."
    },
    "SimpleLicensePlateInput": {
      "type": "object",
      "properties": {
        "value": {
          "type": "string",
          "description": "Plaka metni"
        },
        "scheme": {
          "$ref": "#/definitions/SimpleLicensePlateScheme",
          "description": "Şema — varsayılan: \"PLAKA\""
        }
      },
      "required": [
        "value"
      ],
      "additionalProperties": false,
      "description": "Araç (çekici) plakası — `ShipmentStage/TransportMeans/RoadTransport/LicensePlateID`.\n\n🔴 `LicensePlateIDCheck` (Common:786-788): geçerli şemalı, BOŞ OLMAYAN en az bir plaka HER İRSALİYEDE zorunludur — taşıyıcı firma verilse BİLE. Ekran \"kargoya verdim\" dese de plaka istemek zorundadır. `PLAKA` şemasında biçim `^(0[1-9]|[1-7][0-9]|8[01])[A-Z]+[0-9]+$`; `YABANCIPLAKA` şemasında `^[A-Z0-9_-]+$`. Şematron her plakayı AYRI AYRI denetler (`LicensePlateIDSchemeIDCheck` bağlamı plakanın kendisidir), yani ikinci aracın hatalı plakası da yakalanır."
    },
    "SimpleLicensePlateScheme": {
      "type": "string",
      "enum": [
        "PLAKA",
        "YABANCIPLAKA"
      ],
      "description": "Çekici plaka şema kimlikleri — `LicensePlateIDSchemeIDCheck` (Codelist:37, paket 24.08.2026)."
    },
    "SimpleTrailerPlateInput": {
      "type": "object",
      "properties": {
        "value": {
          "type": "string",
          "description": "Plaka metni — `licensePlates` ile AYNI biçim kurallarına tabidir."
        },
        "scheme": {
          "$ref": "#/definitions/SimpleTrailerPlateScheme",
          "description": "Şema — varsayılan: \"DORSEPLAKA\""
        }
      },
      "required": [
        "value"
      ],
      "additionalProperties": false,
      "description": "Dorse/römork plakası — `Shipment/TransportHandlingUnit/TransportEquipment/ID`.\n\n🔴 NEDEN AYRI ALAN: dorse bir ARAÇ DEĞİL, bir EKİPMANDIR. GİB'in kendi örneği (UBL-TR Sevk İrsaliyesi Kılavuzu V1.2 §2.3.21; `Irsaliye-Ornek1.xml:195-202`) dorseyi `cac:ShipmentStage`in DIŞINDA, `Shipment/TransportHandlingUnit/ TransportEquipment/cbc:ID` altında ve `schemeID=\"DORSEPLAKA\"` ile gösterir — iki dorse orada iki `TransportEquipment` olur. `licensePlates` ise ÇEKİCİ listesidir ve her kaydı ayrı bir `cac:ShipmentStage` üretir.\n\nAyrım BEYAN DOĞRU OLSUN diye vardır: dorseyi `licensePlates`e koymak onu ikinci bir çekici olarak beyan eder. GİB paketi 24.08.2026'dan beri dorse şemaları `LicensePlateID`de zaten geçersizdir (Codelist:37-38)."
    },
    "SimpleTrailerPlateScheme": {
      "type": "string",
      "enum": [
        "DORSE",
        "DORSEPLAKA",
        "YABANCIDORSE",
        "YABANCIDORSEPLAKA"
      ],
      "description": "Dorse plaka şema kimlikleri — `TransportEquipmentIDSchemeIDCheck` (Codelist:38)."
    },
    "SimpleDespatchLineInput": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "Mal/hizmet adı — zorunlu (`ItemNameCheck`)"
        },
        "quantity": {
          "type": "number",
          "description": "Sevk edilen miktar — zorunlu (`DeliveredQuantityCheck`)"
        },
        "unitCode": {
          "type": "string",
          "description": "Birim kodu (UN/ECE Rec20) — zorunlu"
        },
        "description": {
          "type": "string",
          "description": "Açıklama"
        },
        "additionalIdentifications": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/SimpleItemIdentificationInput"
          },
          "description": "Ek kimlikler. HKSIRSALIYE'de HER satırda 19 karakterlik `KUNYENO`, IDISIRSALIYE'de 9 karakterlik `ETIKETNO` ZORUNLUDUR."
        },
        "note": {
          "type": "string",
          "description": "Satır notu"
        }
      },
      "required": [
        "name",
        "quantity",
        "unitCode"
      ],
      "additionalProperties": false,
      "description": "İrsaliye kalemi.\n\n🔴 TUTAR/VERGİ ALANI YOKTUR — `DespatchLineType` XSD'sinde karşılıkları yok. Faturanın 25+ sütunlu kalemiyle karıştırılmamalıdır."
    },
    "SimpleItemIdentificationInput": {
      "type": "object",
      "properties": {
        "scheme": {
          "type": "string",
          "description": "Şema: \"KUNYENO\" (HKS, 19 karakter) / \"ETIKETNO\" (İDİS, 9 karakter) vb."
        },
        "value": {
          "type": "string",
          "description": "Değer"
        }
      },
      "required": [
        "scheme",
        "value"
      ],
      "additionalProperties": false,
      "description": "Ek ürün kimliği — `Item/AdditionalItemIdentification`."
    },
    "SimpleDespatchOrderReferenceInput": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Sipariş numarası"
        },
        "issueDate": {
          "type": "string",
          "description": "Sipariş tarihi (YYYY-MM-DD)"
        }
      },
      "required": [
        "id"
      ],
      "additionalProperties": false,
      "description": "Sipariş referansı — irsaliyede 0..n (XSD `maxOccurs=\"unbounded\"`, B-53)."
    },
    "SimpleDespatchAdditionalDocumentInput": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Belge numarası"
        },
        "issueDate": {
          "type": "string",
          "description": "Belge tarihi (YYYY-MM-DD)"
        },
        "documentTypeCode": {
          "type": "string",
          "description": "Belge tipi kodu"
        },
        "description": {
          "type": "string",
          "description": "Açıklama"
        }
      },
      "required": [
        "id",
        "issueDate"
      ],
      "additionalProperties": false,
      "description": "Ek belge — `AdditionalDocumentReference`. 🔴 `MATBUDAN` tipinde ID ve tarihi dolu EN AZ BİR ek belge ZORUNLUDUR (`DespatchAdviceTypeCodeCheck`)."
    }
  }
}
