openapi: 3.1.0
info:
  title: İmza API'si
  version: "1.0.0"
  description: |
    Türk nitelikli e-imzasıyla (5070) imza isteği açma, izleme, imzalı PDF / delil paketi indirme ve webhook.
    İmzanın kendisi API'den atılmaz: imzacı imza sayfasını açar, e-imza masaüstündeki İmza Programı ve USB kartla atılır.
    API PIN, özel anahtar ya da imza değeri almaz. Ayrıntı: /api-dokumani
    Deneme ortamı: deneme anahtarıyla (imzn_deneme_…) aynı uçlar çalışır; gerçek gönderim, kontör, paket sınırı, zaman damgası ve
    gerçek imza yoktur, kayıtlar "test": true taşır ve 7 gün sonra silinir. /deneme/... uçları imzacıyı taklit eder.
servers:
  - url: /api/v1
security:
  - anahtar: []
tags:
  - name: İmza istekleri
  - name: Deneme ortamı
    description: Yalnız deneme anahtarıyla. Canlı anahtar 403 DENEME_ANAHTARI_GEREKLI alır.
  - name: Webhook

paths:
  /imza-istekleri:
    post:
      tags: [İmza istekleri]
      summary: İmza isteği aç
      description: "Yetki: imza:yaz. Var olan belgeden (belge_id) ya da yeni PDF'ten (pdf / pdf_base64)."
      operationId: imzaIstegiAc
      parameters:
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/ImzaIstegiAc" }
            example:
              pdf_base64: "JVBERi0xLjQK..."
              belge_adi: Kira sözleşmesi
              imzacilar:
                - { ad: Ayşe, soyad: Yılmaz, eposta: ayse@example.com, telefon: "0532 123 45 67" }
              sirali: true
              imza_turu: e_imza
              mesaj: Kira sözleşmesini imzalamanızı rica ederiz.
              istemci_ref: CRM-88412
          multipart/form-data:
            schema:
              allOf:
                - $ref: "#/components/schemas/ImzaIstegiAc"
                - type: object
                  properties:
                    pdf: { type: string, format: binary, description: "PDF, en çok 20 MB" }
      responses:
        "201":
          description: Açıldı (ya da aynı Idempotency-Key ile tekrar)
          headers:
            Location: { schema: { type: string } }
            Idempotent-Replayed: { schema: { type: string, enum: ["true"] } }
          content:
            application/json:
              schema:
                type: object
                properties: { data: { $ref: "#/components/schemas/ImzaIstegi" } }
        "401": { $ref: "#/components/responses/Kimlik" }
        "403": { $ref: "#/components/responses/Yasak" }
        "409": { $ref: "#/components/responses/Cakisma" }
        "422": { $ref: "#/components/responses/Gecersiz" }
        "429": { $ref: "#/components/responses/Sinir" }
    get:
      tags: [İmza istekleri]
      summary: İmza isteklerini listele
      description: "Yetki: imza:oku. Firma sahibi bütün istekleri, personel yalnız kendi açtıklarını görür."
      operationId: imzaIstekleriniListele
      parameters:
        - { name: durum, in: query, schema: { $ref: "#/components/schemas/IstekDurumu" } }
        - { name: baslangic, in: query, schema: { type: string, format: date }, description: "Açılış günü ≥" }
        - { name: bitis, in: query, schema: { type: string, format: date }, description: "Açılış günü ≤" }
        - { name: istemci_ref, in: query, schema: { type: string, maxLength: 100 } }
        - { name: belge_id, in: query, schema: { type: integer } }
        - { name: sayfa, in: query, schema: { type: integer, minimum: 1, default: 1 } }
        - { name: sayfa_boyu, in: query, schema: { type: integer, minimum: 1, maximum: 100, default: 25 } }
      responses:
        "200":
          description: Liste
          content:
            application/json:
              schema:
                type: object
                properties:
                  data: { type: array, items: { $ref: "#/components/schemas/ImzaIstegi" } }
                  meta: { $ref: "#/components/schemas/Sayfa" }
        "401": { $ref: "#/components/responses/Kimlik" }
        "403": { $ref: "#/components/responses/Yasak" }
        "422": { $ref: "#/components/responses/Gecersiz" }

  /imza-istekleri/{id}:
    parameters: [ { $ref: "#/components/parameters/Id" } ]
    get:
      tags: [İmza istekleri]
      summary: İmza isteğinin durumu
      description: "Yetki: imza:oku."
      operationId: imzaIstegiGetir
      responses:
        "200":
          description: Ayrıntı
          content:
            application/json:
              schema:
                type: object
                properties: { data: { $ref: "#/components/schemas/ImzaIstegi" } }
        "401": { $ref: "#/components/responses/Kimlik" }
        "403": { $ref: "#/components/responses/Yasak" }
        "404": { $ref: "#/components/responses/Yok" }

  /imza-istekleri/{id}/iptal:
    parameters: [ { $ref: "#/components/parameters/Id" } ]
    post:
      tags: [İmza istekleri]
      summary: İsteği iptal et
      description: "Yetki: imza:yaz. İsteği açan ya da firma sahibi."
      operationId: imzaIstegiIptal
      responses:
        "200":
          description: İptal edildi
          content:
            application/json:
              schema:
                type: object
                properties: { data: { $ref: "#/components/schemas/ImzaIstegi" } }
        "403": { $ref: "#/components/responses/Yasak" }
        "404": { $ref: "#/components/responses/Yok" }
        "409": { $ref: "#/components/responses/Cakisma" }

  /imza-istekleri/{id}/hatirlat:
    parameters: [ { $ref: "#/components/parameters/Id" } ]
    post:
      tags: [İmza istekleri]
      summary: Sırası gelen imzacılara hatırlatma gönder
      description: "Yetki: imza:yaz. Aynı isteğe saatte bir."
      operationId: imzaIstegiHatirlat
      responses:
        "200":
          description: Gönderildi
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      gonderilen: { type: integer }
                      atlanan:
                        type: array
                        items:
                          type: object
                          properties:
                            imzaci_id: { type: integer }
                            neden: { type: string, enum: [yeni_davet, oturum_acik, davet_yok, sira_degil, kullanici_yok, paket_siniri, gonderilemedi] }
                      test: { type: boolean, description: "Yalnız deneme anahtarında (true): hiçbir şey gönderilmedi, kayda düşüldü" }
        "403": { $ref: "#/components/responses/Yasak" }
        "404": { $ref: "#/components/responses/Yok" }
        "409": { $ref: "#/components/responses/Cakisma" }
        "429": { $ref: "#/components/responses/Sinir" }

  /imza-istekleri/{id}/imzali-pdf:
    parameters: [ { $ref: "#/components/parameters/Id" } ]
    get:
      tags: [İmza istekleri]
      summary: E-imzalı PDF (baytı baytına)
      description: "Yetki: imza:oku. Yalnız tamamlanmış e-imzalı istek."
      operationId: imzaliPdf
      responses:
        "200":
          description: PDF
          headers:
            X-Imza-SHA256: { schema: { type: string, pattern: "^[a-f0-9]{64}$" } }
          content:
            application/pdf:
              schema: { type: string, format: binary }
        "403": { $ref: "#/components/responses/Yasak" }
        "404": { $ref: "#/components/responses/Yok" }
        "409": { $ref: "#/components/responses/Cakisma" }

  /imza-istekleri/{id}/delil-paketi:
    parameters: [ { $ref: "#/components/parameters/Id" } ]
    get:
      tags: [İmza istekleri]
      summary: Delil paketi (ZIP)
      description: "Yetki: imza:delil + firma sahibi ya da rolde 'download document evidence'."
      operationId: delilPaketi
      responses:
        "200":
          description: ZIP
          content:
            application/zip:
              schema: { type: string, format: binary }
        "403": { $ref: "#/components/responses/Yasak" }
        "404": { $ref: "#/components/responses/Yok" }
        "429": { $ref: "#/components/responses/Sinir" }

  /imza-istekleri/{id}/dogrulama:
    parameters: [ { $ref: "#/components/parameters/Id" } ]
    get:
      tags: [İmza istekleri]
      summary: Doğrulama sonucu (/dogrula sayfasının JSON hâli)
      description: "Yetki: imza:oku. Yalnız e-imzalı istek."
      operationId: dogrulama
      responses:
        "200":
          description: Sonuç
          content:
            application/json:
              schema:
                type: object
                properties: { data: { $ref: "#/components/schemas/Dogrulama" } }
        "403": { $ref: "#/components/responses/Yasak" }
        "404": { $ref: "#/components/responses/Yok" }
        "409": { $ref: "#/components/responses/Cakisma" }

  /deneme/imza-istekleri/{id}/imzala:
    parameters: [ { $ref: "#/components/parameters/Id" } ]
    post:
      tags: [Deneme ortamı]
      summary: "Deneme: sıradaki imzacıyı imzalamış say"
      description: |
        Yetki: imza:yaz, yalnız deneme anahtarı. Sırası gelmiş (imza_bekleniyor) ilk imzacıyı ya da `imzaci_id` verileni sahte imzalanmış yapar;
        sıralı istekte sıradakini açar, herkes imzaladıysa isteği tamamlar. Webhook: imzaci.imzaladi (+ imza_istegi.tamamlandi), "test": true.
      operationId: denemeImzala
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                imzaci_id: { type: integer, description: "Boşsa sıradaki ilk imzacı" }
            example: {}
      responses:
        "200": { $ref: "#/components/responses/DenemeIslemi" }
        "403": { $ref: "#/components/responses/Yasak" }
        "404": { $ref: "#/components/responses/Yok" }
        "409": { $ref: "#/components/responses/Cakisma" }

  /deneme/imza-istekleri/{id}/reddet:
    parameters: [ { $ref: "#/components/parameters/Id" } ]
    post:
      tags: [Deneme ortamı]
      summary: "Deneme: sıradaki imzacı reddetsin"
      description: "Yetki: imza:yaz, yalnız deneme anahtarı. İstek reddedildi olur. Webhook: imzaci.reddetti, \"test\": true."
      operationId: denemeReddet
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                imzaci_id: { type: integer }
                gerekce: { type: string, maxLength: 500 }
            example: { gerekce: "Tutar hatalı" }
      responses:
        "200": { $ref: "#/components/responses/DenemeIslemi" }
        "403": { $ref: "#/components/responses/Yasak" }
        "404": { $ref: "#/components/responses/Yok" }
        "409": { $ref: "#/components/responses/Cakisma" }

  /deneme/imza-istekleri/{id}/tamamla:
    parameters: [ { $ref: "#/components/parameters/Id" } ]
    post:
      tags: [Deneme ortamı]
      summary: "Deneme: bütün imzacıları imzalamış say"
      description: |
        Yetki: imza:yaz, yalnız deneme anahtarı. Her imzacı için imzaci.imzaladi, sonunda imza_istegi.tamamlandi gider. Ardından
        /imza-istekleri/{id}/imzali-pdf "DENEME — HUKUKİ GEÇERLİLİĞİ YOKTUR" filigranlı, gerçek imza taşımayan bir PDF döner.
      operationId: denemeTamamla
      responses:
        "200":
          description: Tamamlandı
          content:
            application/json:
              schema:
                type: object
                properties: { data: { $ref: "#/components/schemas/ImzaIstegi" } }
        "403": { $ref: "#/components/responses/Yasak" }
        "404": { $ref: "#/components/responses/Yok" }
        "409": { $ref: "#/components/responses/Cakisma" }

  /webhooklar:
    post:
      tags: [Webhook]
      summary: Webhook ucu ekle
      description: "Yetki: webhook:yonet, firma sahibinin anahtarı. Cevaptaki `sir` yalnız bir kez gösterilir."
      operationId: webhookEkle
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [url, olaylar]
              properties:
                url: { type: string, format: uri, maxLength: 500, description: "Canlıda yalnız https" }
                olaylar: { type: array, minItems: 1, items: { $ref: "#/components/schemas/OlayAdi" } }
                aciklama: { type: string, maxLength: 120 }
            example:
              url: https://ornek.com/imzanova/webhook
              olaylar: [imza_istegi.olusturuldu, imzaci.imzaladi, imzaci.reddetti, imza_istegi.tamamlandi, imza_istegi.iptal]
              aciklama: CRM
      responses:
        "201":
          description: Eklendi
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    allOf:
                      - $ref: "#/components/schemas/WebhookUcu"
                      - type: object
                        properties: { sir: { type: string, description: "HMAC sırrı; yalnız bu cevapta" } }
        "403": { $ref: "#/components/responses/Yasak" }
        "422": { $ref: "#/components/responses/Gecersiz" }
    get:
      tags: [Webhook]
      summary: Webhook uçları
      operationId: webhookListele
      responses:
        "200":
          description: Liste
          content:
            application/json:
              schema:
                type: object
                properties:
                  data: { type: array, items: { $ref: "#/components/schemas/WebhookUcu" } }
        "403": { $ref: "#/components/responses/Yasak" }

  /webhooklar/{id}:
    parameters: [ { $ref: "#/components/parameters/Id" } ]
    delete:
      tags: [Webhook]
      summary: Webhook ucunu sil
      operationId: webhookSil
      responses:
        "200":
          description: Silindi
          content:
            application/json:
              schema: { $ref: "#/components/schemas/Mesaj" }
        "403": { $ref: "#/components/responses/Yasak" }
        "404": { $ref: "#/components/responses/Yok" }

webhooks:
  imzaOlayi:
    post:
      summary: Firmanın ucuna giden olay
      description: |
        Başlıklar: `X-Imza-Olay`, `X-Imza-Teslimat`, `X-Imza-Imza: t=<unix>,v1=<hex>`;
        v1 = HMAC-SHA256(sır, "<t>.<ham gövde>"). 2xx teslim sayılır; yönlendirme izlenmez.
      parameters:
        - { name: X-Imza-Imza, in: header, required: true, schema: { type: string, example: "t=1795873770,v1=5d3c…" } }
        - { name: X-Imza-Olay, in: header, required: true, schema: { $ref: "#/components/schemas/OlayAdi" } }
        - { name: X-Imza-Teslimat, in: header, required: true, schema: { type: string } }
      requestBody:
        content:
          application/json:
            schema: { $ref: "#/components/schemas/WebhookGovdesi" }
      responses:
        "200": { description: Alındı }

components:
  securitySchemes:
    anahtar:
      type: http
      scheme: bearer
      description: |
        Canlı anahtar: panelde "API Tokens" sayfasında. Deneme anahtarı ("imzn_deneme_" önekli): Ayarlar → API ve Webhook → Deneme anahtarları
        (her pakette). Yetkiler imza:oku, imza:yaz, imza:delil, webhook:yonet.

  parameters:
    Id:
      name: id
      in: path
      required: true
      schema: { type: integer }
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      schema: { type: string, maxLength: 255 }
      description: Aynı anahtar + aynı gövde → aynı cevap; farklı gövde → 409. 24 saat saklanır.

  responses:
    Kimlik:
      description: Anahtar yok / geçersiz / oturumla gelindi (ANAHTAR_GEREKLI)
      content: { application/json: { schema: { $ref: "#/components/schemas/Hata" } } }
    Yasak:
      description: "YETKI_YOK, ROL_YETKISI_YOK, HESAP_TURU, PLAN_API_KAPALI, SAHIP_GEREKLI, DENEME_ANAHTARI_GEREKLI"
      content: { application/json: { schema: { $ref: "#/components/schemas/Hata" } } }
    Yok:
      description: BULUNAMADI (başka firmanın kaydı da)
      content: { application/json: { schema: { $ref: "#/components/schemas/Hata" } } }
    Cakisma:
      description: "ISTEK_KAPALI, TAMAMLANMADI, E_IMZA_DEGIL, ZAMAN_DAMGASI_BEKLIYOR, IDEMPOTENCY_CAKISMA, IDEMPOTENCY_ISLENIYOR, SIRA_DEGIL (deneme)"
      content: { application/json: { schema: { $ref: "#/components/schemas/Hata" } } }
    Gecersiz:
      description: "Doğrulama hatası (errors) ya da IMZA_ISTEGI_ACILAMADI, PAKET_SINIRI, IDEMPOTENCY_GECERSIZ, DENEME_DESTEKLENMIYOR"
      content: { application/json: { schema: { $ref: "#/components/schemas/Hata" } } }
    Sinir:
      description: Sınır aşıldı (Retry-After) ya da DENEME_SINIRI (firma başına günlük deneme isteği)
      content: { application/json: { schema: { $ref: "#/components/schemas/Hata" } } }
    DenemeIslemi:
      description: Güncel istek ve yapılan işlem
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                allOf:
                  - $ref: "#/components/schemas/ImzaIstegi"
                  - type: object
                    properties:
                      islem:
                        type: object
                        properties:
                          imzaci_id: { type: integer }
                          sonuc: { type: string, enum: [imzaladi, reddetti] }

  schemas:
    Hata:
      type: object
      required: [message]
      properties:
        message: { type: string }
        kod: { type: string }
        errors: { type: object, additionalProperties: { type: array, items: { type: string } } }
    Mesaj:
      type: object
      properties: { message: { type: string } }
    Sayfa:
      type: object
      properties:
        page: { type: integer }
        per_page: { type: integer }
        total: { type: integer }
        last_page: { type: integer }
    IstekDurumu:
      type: string
      enum: [bekliyor, tamamlandi, reddedildi, iptal]
    OlayAdi:
      type: string
      enum: [imza_istegi.olusturuldu, imzaci.imzaladi, imzaci.reddetti, imza_istegi.tamamlandi, imza_istegi.iptal, zaman_damgasi.eklendi, test.ping]
    ImzaciGirdisi:
      oneOf:
        - type: object
          required: [kullanici_id]
          properties:
            kullanici_id: { type: integer, description: "Firmanızın personeli ya da müşterisi" }
        - type: object
          required: [ad, soyad, eposta]
          description: Dış imzacı (sistem kullanıcısı değil); yalnız e-imza
          properties:
            ad: { type: string, maxLength: 60 }
            soyad: { type: string, maxLength: 60 }
            eposta: { type: string, format: email, maxLength: 255 }
            telefon: { type: string, maxLength: 32, description: "Türk cep numarası" }
            tckn: { type: string, pattern: "^[1-9][0-9]{10}$", description: "Verilirse imzacı yalnız bu numarayı girebilir; saklanmaz, yalnız özeti" }
    ImzaIstegiAc:
      type: object
      required: [imzacilar]
      properties:
        belge_id: { type: integer, description: "Var olan belge; pdf / pdf_base64 ile birlikte verilmez" }
        dosya: { type: string, description: "Belgenin güncel sürümündeki PDF dosyası; tek PDF varsa gerekmez" }
        pdf_base64: { type: string, contentEncoding: base64, description: "Yeni PDF (JSON ile)" }
        belge_adi: { type: string, maxLength: 200 }
        kategori_id: { type: integer }
        imzacilar: { type: array, minItems: 1, maxItems: 10, items: { $ref: "#/components/schemas/ImzaciGirdisi" } }
        sirali: { type: boolean, default: true }
        imza_turu: { type: string, enum: [e_imza, cizim], default: e_imza }
        mesaj: { type: string, maxLength: 500 }
        son_tarih: { type: string, format: date }
        istemci_ref: { type: string, maxLength: 100, pattern: "^[A-Za-z0-9._:-]+$" }
    Imzaci:
      type: object
      properties:
        id: { type: integer }
        sira: { type: integer }
        tur: { type: string, enum: [kullanici, dis] }
        kullanici_id: { type: [integer, "null"] }
        ad: { type: string }
        eposta: { type: string }
        durum: { type: string, enum: [sirasini_bekliyor, imza_bekleniyor, imzaladi, reddetti] }
        imzalandi: { type: [string, "null"], format: date-time }
        yontem: { type: [string, "null"], enum: [e_imza, cizim, null] }
        ret_gerekcesi: { type: [string, "null"] }
        tckn_beklenen: { type: boolean, description: "Yalnız dış imzacıda: açılışta TCKN verildi mi" }
    ZamanDamgasi:
      type: object
      properties:
        tur: { type: string, enum: [T, LTA] }
        durum: { type: string, enum: [bekliyor, eklendi, hata] }
        zaman: { type: [string, "null"], format: date-time }
        tsa: { type: [string, "null"] }
        test: { type: boolean }
    ImzaIstegi:
      type: object
      properties:
        id: { type: integer, description: "Deneme ve canlı kimlikleri ayrı sayaçtır; ikisini test alanıyla ayırın" }
        test: { type: boolean, description: "Deneme anahtarıyla açılan kayıtta true (gerçek gönderim, imza, kontör yok)" }
        durum: { $ref: "#/components/schemas/IstekDurumu" }
        imza_turu: { type: string, enum: [e_imza, cizim] }
        sirali: { type: boolean }
        belge:
          type: object
          properties:
            id: { type: [integer, "null"], description: "Deneme kaydında null (canlı belge açılmaz)" }
            numara: { type: string }
            ad: { type: string }
        dosya: { type: string }
        mesaj: { type: [string, "null"] }
        son_tarih: { type: [string, "null"], format: date }
        istemci_ref: { type: [string, "null"] }
        kaynak: { type: string, enum: [api, panel] }
        olusturuldu: { type: string, format: date-time }
        tamamlandi: { type: [string, "null"], format: date-time }
        imzacilar: { type: array, items: { $ref: "#/components/schemas/Imzaci" } }
        e_imza:
          type: [object, "null"]
          properties:
            durum: { type: string, enum: [bekliyor, zaman_damgasi, tamamlandi] }
            dogrulama_adresi: { type: [string, "null"] }
            imzali_pdf_sha256: { type: [string, "null"] }
            zaman_damgalari: { type: array, items: { $ref: "#/components/schemas/ZamanDamgasi" } }
        baglantilar: { type: object, additionalProperties: { type: string } }
        deneme:
          type: object
          description: "Yalnız deneme kaydında: gönderilmeyen bildirimlerin kaydı ve silinme zamanı"
          properties:
            not: { type: string }
            silinecek: { type: string, format: date-time }
            bildirimler:
              type: array
              items:
                type: object
                properties:
                  tur: { type: string, enum: [davet, hatirlatma, tamamlandi] }
                  imzaci_id: { type: [integer, "null"] }
                  kanallar: { type: array, items: { type: string, enum: [eposta, sms, panel] } }
                  zaman: { type: string, format: date-time }
                  gonderildi: { type: boolean, enum: [false] }
        dosya_aktarimi:
          type: array
          description: "Yalnız GET /imza-istekleri/{id}: firmanın SFTP/FTPS sunucularına teslim durumu (docs/api-imza.md §3)."
          items:
            type: object
            properties:
              id: { type: integer }
              hedef_id: { type: integer }
              hedef: { type: [string, "null"] }
              tetik: { type: string, enum: [tamamlandi, zaman_damgasi] }
              durum: { type: string, enum: [bekliyor, basarili, basarisiz, iptal] }
              deneme: { type: integer }
              sonraki_deneme: { type: [string, "null"], format: date-time }
              son_hata: { type: [string, "null"] }
              teslim_edildi: { type: [string, "null"], format: date-time }
              dosyalar:
                type: array
                items:
                  type: object
                  properties:
                    ad: { type: string }
                    tur: { type: string, enum: [imzali_pdf, belge, delil_paketi, meta] }
                    boyut: { type: integer }
                    sha256: { type: string }
    Dogrulama:
      type: object
      properties:
        durum: { type: string }
        belge: { type: [string, "null"] }
        dogrulama_adresi: { type: string }
        toplam_imzaci: { type: integer }
        imzalar:
          type: array
          items:
            type: object
            properties:
              sertifika_sahibi: { type: string }
              yayinci: { type: string }
              imza_zamani: { type: [string, "null"], format: date-time }
              seviye: { type: string }
              zaman_damgasi: { $ref: "#/components/schemas/ZamanDamgasi" }
        lta: { oneOf: [ { $ref: "#/components/schemas/ZamanDamgasi" }, { type: "null" } ] }
        denetim:
          type: [object, "null"]
          description: DSS denetimi (AB DSS 6.1)
          properties:
            gecerli: { type: boolean }
            imzalar:
              type: array
              items:
                type: object
                properties:
                  imzaci: { type: string }
                  sonuc: { type: string }
                  seviye: { type: string }
        denetim_hatasi: { type: [string, "null"] }
    WebhookUcu:
      type: object
      properties:
        id: { type: integer }
        url: { type: string }
        aciklama: { type: [string, "null"] }
        olaylar: { type: array, items: { $ref: "#/components/schemas/OlayAdi" } }
        aktif: { type: boolean }
        devre_disi_nedeni: { type: [string, "null"] }
        sir_ipucu: { type: string, description: "Sırrın son 4 karakteri" }
        olusturuldu: { type: string, format: date-time }
    WebhookGovdesi:
      type: object
      required: [id, olay, olusturuldu, test, veri]
      properties:
        id: { type: string, description: "Olay numarası (UUID); aynı olay her uca aynı id ile gider" }
        olay: { $ref: "#/components/schemas/OlayAdi" }
        olusturuldu: { type: string, format: date-time }
        test: { type: boolean, description: "Deneme anahtarıyla açılan isteğin olayında true" }
        veri:
          type: object
          properties:
            imza_istegi: { $ref: "#/components/schemas/ImzaIstegi" }
            imzaci: { $ref: "#/components/schemas/Imzaci" }
            zaman_damgasi: { $ref: "#/components/schemas/ZamanDamgasi" }
