{
  "openapi": "3.0.3",
  "info": {
    "title": "Aliağa ve İzmir Nöbetçi Eczaneler API",
    "description": "Aliağa, Yeni Şakran ve tüm İzmir genelindeki güncel nöbetçi eczane verilerini sağlayan RESTful API servisi.\n\n### Özellikler\n- **Gerçek Zamanlı Veri:** İzmir Büyükşehir Belediyesi Açık Veri Portalı entegrasyonu.\n- **Coğrafi Mesafe Hesaplama:** Kullanıcı koordinatları (`lat`, `lon`) ile en yakından uzağa sıralama.\n- **İcap Nöbeti Tespiti:** 21:00 / 24:00 sonrası icap nöbeti uyarıları.\n- **Akıllı Arama:** Eczane adı, mahalle, cadde veya telefonla arama desteği.\n- **Edge CDN Cache:** Yüksek hızlı, 3 dakikalık CDN önbellekleme.\n\n**Hizmet Sağlayıcı:** [Fatih Acar Bilişim](https://www.fatihacar.com.tr) & [Aliağam.NET](https://nobetcieczane.aliagam.net)",
    "version": "1.0.0",
    "contact": {
      "name": "Fatih Acar Bilişim Hizmetleri",
      "url": "https://www.fatihacar.com.tr"
    }
  },
  "servers": [
    {
      "url": "https://nobetcieczane.aliagam.net",
      "description": "Aliagam.NET"
    }
  ],
  "paths": {
    "/api/eczaneler": {
      "get": {
        "summary": "Güncel Nöbetçi Eczaneleri Listele",
        "description": "Seçilen bölge ve tarihe göre güncel nöbetçi eczaneleri döndürür. İsteğe bağlı olarak kullanıcı koordinatlarına göre mesafe hesaplar ve en yakından uzağa sıralar.",
        "operationId": "getNobetciEczaneler",
        "tags": [
          "Eczaneler"
        ],
        "parameters": [
          {
            "name": "bolge",
            "in": "query",
            "description": "Filtrelenecek bölge veya ilçe adı.",
            "required": false,
            "schema": {
              "type": "string",
              "default": "aliaga-sakran",
              "enum": [
                "aliaga-sakran",
                "aliaga",
                "yeni-sakran",
                "all",
                "bornova",
                "karsiyaka",
                "menemen",
                "bergama",
                "foca"
              ]
            },
            "example": "aliaga-sakran"
          },
          {
            "name": "tarih",
            "in": "query",
            "description": "Sorgulanacak tarih (YYYY-MM-DD). Boş bırakılırsa Türkiye saatine göre bugünün tarihi kullanılır.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "example": "2026-10-14"
          },
          {
            "name": "lat",
            "in": "query",
            "description": "Kullanıcının enlem koordinatı (WGS84). Mesafe hesaplamak ve yakına göre sıralamak için lon ile birlikte kullanılır.",
            "required": false,
            "schema": {
              "type": "number",
              "format": "float"
            },
            "example": 38.7993
          },
          {
            "name": "lon",
            "in": "query",
            "description": "Kullanıcının boylam koordinatı (WGS84).",
            "required": false,
            "schema": {
              "type": "number",
              "format": "float"
            },
            "example": 26.9705
          },
          {
            "name": "q",
            "in": "query",
            "description": "Metin tabanlı arama kelimesi (eczane adı, sokak, mahalle veya telefon).",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "Başak"
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Döndürülecek maksimum eczane sayısı.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            },
            "example": 10
          }
        ],
        "responses": {
          "200": {
            "description": "Başarılı eczane listesi yanıtı",
            "headers": {
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string"
                },
                "description": "Tüm alan adlarından CORS erişimine izin verir (*)"
              },
              "Cache-Control": {
                "schema": {
                  "type": "string"
                },
                "description": "Edge CDN önbellek başlığı"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EczaneResponse"
                },
                "example": {
                  "success": true,
                  "meta": {
                    "tarih": "2026-10-14",
                    "tarih_metin": "14 Ekim 2026, Çarşamba",
                    "toplam_sonuc": 2,
                    "filtreler": {
                      "bolge": "aliaga-sakran",
                      "tarih": "2026-10-14",
                      "arama_kelimesi": null,
                      "kullanici_koordinat": {
                        "enlem": 38.7993,
                        "boylam": 26.9705
                      },
                      "limit": null
                    },
                    "sunucu_zamani": "2026-10-14T10:45:00.000Z"
                  },
                  "data": [
                    {
                      "eczane_id": -1,
                      "adi": "BAŞAK ECZANESİ",
                      "bolge": "ALİAĞA",
                      "bolge_aciklama": "",
                      "icap_nobeti": false,
                      "tarih": "2026-10-14T08:00:00",
                      "adres": "ATATÜRK MAH. FATİH CAD. NO:31/A",
                      "telefon": "02326160633",
                      "telefon_formatli": "0 (232) 616 06 33",
                      "lokasyon": {
                        "enlem": 38.796919,
                        "boylam": 26.968721
                      },
                      "harita_yonlendirme_url": "https://www.google.com/maps/dir/?api=1&destination=38.796919,26.968721",
                      "mesafe_km": 0.36,
                      "mesafe_metre": 360
                    },
                    {
                      "eczane_id": -1,
                      "adi": "YAZAL ECZANESİ",
                      "bolge": "YENİ ŞAKRAN",
                      "bolge_aciklama": "21:00 DEN SONRA- İCAP NÖBETİ TUTULMAKTADIR.",
                      "icap_nobeti": true,
                      "tarih": "2026-10-14T08:00:00",
                      "adres": "SAYFIYE MAH. KAZIM DIRIK CAD.NO:58/AYENI SAKRAN-ALIAGA/IZMIR",
                      "telefon": "02326287143",
                      "telefon_formatli": "0 (232) 628 71 43",
                      "lokasyon": {
                        "enlem": 38.889168,
                        "boylam": 27.065746
                      },
                      "harita_yonlendirme_url": "https://www.google.com/maps/dir/?api=1&destination=38.889168,27.065746",
                      "mesafe_km": 12.93,
                      "mesafe_metre": 12925
                    }
                  ]
                }
              }
            }
          },
          "405": {
            "description": "Geçersiz İstek Metodu (Yalnızca GET desteklenir)"
          },
          "500": {
            "description": "Sunucu veya Harici API Hatası"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "EczaneResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "meta": {
            "type": "object",
            "properties": {
              "tarih": {
                "type": "string",
                "example": "2026-10-14"
              },
              "tarih_metin": {
                "type": "string",
                "example": "14 Ekim 2026, Çarşamba"
              },
              "toplam_sonuc": {
                "type": "integer",
                "example": 2
              },
              "filtreler": {
                "type": "object"
              },
              "sunucu_zamani": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EczaneItem"
            }
          }
        }
      },
      "EczaneItem": {
        "type": "object",
        "properties": {
          "eczane_id": {
            "type": "integer",
            "example": 3849
          },
          "adi": {
            "type": "string",
            "example": "BAŞAK ECZANESİ"
          },
          "bolge": {
            "type": "string",
            "example": "ALİAĞA"
          },
          "bolge_aciklama": {
            "type": "string",
            "example": "21:00 DEN SONRA İCAP NÖBETİ TUTULMAKTADIR."
          },
          "icap_nobeti": {
            "type": "boolean",
            "example": false
          },
          "tarih": {
            "type": "string",
            "example": "2026-10-14T08:00:00"
          },
          "adres": {
            "type": "string",
            "example": "ATATÜRK MAH. FATİH CAD. NO:31/A"
          },
          "telefon": {
            "type": "string",
            "example": "02326160633"
          },
          "telefon_formatli": {
            "type": "string",
            "example": "0 (232) 616 06 33"
          },
          "lokasyon": {
            "type": "object",
            "properties": {
              "enlem": {
                "type": "number",
                "format": "float",
                "example": 38.796919
              },
              "boylam": {
                "type": "number",
                "format": "float",
                "example": 26.968721
              }
            }
          },
          "harita_yonlendirme_url": {
            "type": "string",
            "format": "uri",
            "example": "https://www.google.com/maps/dir/?api=1&destination=38.796919,26.968721"
          },
          "mesafe_km": {
            "type": "number",
            "format": "float",
            "nullable": true,
            "example": 1.2
          },
          "mesafe_metre": {
            "type": "integer",
            "nullable": true,
            "example": 1200
          }
        }
      }
    }
  }
}