{
  "openapi": "3.1.0",
  "info": {
    "title": "Lodosa Konaklama — açık ilan API'si (demo)",
    "version": "1.0.0",
    "description": "Lodosa Konaklama sitesinin salt okunur ilan API'si. Yalnız yayındaki kayıtlar; kişisel veri içermez. Alan adları Türkçedir. Aynı veri MCP uç noktasından (https://lodosa-konaklama.pages.dev/mcp) ve Markdown (.md) sayfalarından da okunabilir. Demo ortamı: firma ve ilanlar kurgusaldır.",
    "contact": {
      "name": "Lodosa Konaklama",
      "email": "rezervasyon@lodosa.example"
    }
  },
  "servers": [
    {
      "url": "https://lodosa-konaklama.pages.dev",
      "description": "Yerel demo sunucusu"
    }
  ],
  "paths": {
    "/api/konaklama": {
      "get": {
        "operationId": "konaklamaAra",
        "summary": "Konaklama ara",
        "description": "Sitedeki /konaklama sayfasıyla aynı filtreler. giris+cikis verilirse yalnız müsait birimler ve her biri için teklif döner.",
        "parameters": [
          {
            "name": "bolge",
            "in": "query",
            "required": false,
            "description": "Bölge/ilçe/mahalle (virgülle birden çok)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tip",
            "in": "query",
            "required": false,
            "description": "Tip (virgülle birden çok)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "giris",
            "in": "query",
            "required": false,
            "description": "Giriş tarihi",
            "schema": {
              "type": "string",
              "format": "date",
              "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$"
            }
          },
          {
            "name": "cikis",
            "in": "query",
            "required": false,
            "description": "Çıkış tarihi (gece sayılmaz)",
            "schema": {
              "type": "string",
              "format": "date",
              "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$"
            }
          },
          {
            "name": "kisi",
            "in": "query",
            "required": false,
            "description": "Kişi sayısı",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "fiyatMax",
            "in": "query",
            "required": false,
            "description": "Gecelik en yüksek fiyat (TL; tarih varsa ortalama gece)",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "olanak",
            "in": "query",
            "required": false,
            "description": "Olanak kodları (virgülle; hepsi bulunmalı)",
            "schema": {
              "type": "string"
            },
            "examples": [
              "ozel-havuz,wifi"
            ]
          },
          {
            "name": "turlu",
            "in": "query",
            "required": false,
            "description": "Yalnız 3B/360° turu olanlar",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "metin",
            "in": "query",
            "required": false,
            "description": "Serbest metin",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sirala",
            "in": "query",
            "required": false,
            "description": "Sıralama",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sayfa",
            "in": "query",
            "required": false,
            "description": "Sayfa (1’den başlar)",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "boyut",
            "in": "query",
            "required": false,
            "description": "Sayfa boyutu (en çok 100, varsayılan 12)",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Konaklama listesi",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KonaklamaListesi"
                }
              }
            }
          }
        }
      }
    },
    "/api/konaklama/{id}": {
      "get": {
        "operationId": "konaklamaGetir",
        "summary": "Tek konaklama",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Birim no (LD-201) ya da kısa ad",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Konaklama",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Konaklama"
                }
              }
            }
          },
          "404": {
            "description": "Bulunamadı",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Hata"
                }
              }
            }
          },
          "410": {
            "description": "Yayından kaldırıldı",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Hata"
                }
              }
            }
          }
        }
      }
    },
    "/api/konaklama/{id}/musaitlik": {
      "get": {
        "operationId": "musaitlik",
        "summary": "Dolu geceler",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Birim no",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "bas",
            "in": "query",
            "required": false,
            "description": "Pencere başı (varsayılan bugün)",
            "schema": {
              "type": "string",
              "format": "date",
              "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$"
            }
          },
          {
            "name": "bit",
            "in": "query",
            "required": false,
            "description": "Pencere sonu, hariç (varsayılan +60 gün)",
            "schema": {
              "type": "string",
              "format": "date",
              "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Müsaitlik",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Musaitlik"
                }
              }
            }
          },
          "400": {
            "description": "Geçersiz tarih",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Hata"
                }
              }
            }
          },
          "404": {
            "description": "Bulunamadı",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Hata"
                }
              }
            }
          },
          "410": {
            "description": "Yayından kaldırıldı",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Hata"
                }
              }
            }
          }
        }
      }
    },
    "/api/konaklama/{id}/teklif": {
      "get": {
        "operationId": "teklif",
        "summary": "Fiyat teklifi (rezervasyon değildir)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Birim no",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "giris",
            "in": "query",
            "required": true,
            "description": "Giriş",
            "schema": {
              "type": "string",
              "format": "date",
              "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$"
            }
          },
          {
            "name": "cikis",
            "in": "query",
            "required": true,
            "description": "Çıkış",
            "schema": {
              "type": "string",
              "format": "date",
              "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$"
            }
          },
          {
            "name": "kisi",
            "in": "query",
            "required": false,
            "description": "Kişi (varsayılan 2)",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 30
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Teklif",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Teklif"
                }
              }
            }
          },
          "400": {
            "description": "Geçersiz girdi",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Hata"
                }
              }
            }
          },
          "404": {
            "description": "Bulunamadı",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Hata"
                }
              }
            }
          },
          "410": {
            "description": "Yayından kaldırıldı",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Hata"
                }
              }
            }
          }
        }
      }
    },
    "/api/bolgeler": {
      "get": {
        "operationId": "bolgeler",
        "summary": "Yayındaki kayıtların ilçeleri ve sayıları",
        "responses": {
          "200": {
            "description": "Bölgeler",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Bolgeler"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Konaklama": {
        "type": "object",
        "description": "Yayındaki günlük kiralık birim (herkese açık alanlar). Fiyatlar tamsayı TL; sezon fiyatları \"AA-GG\" aralıklarıdır.",
        "properties": {
          "id": {
            "type": "string",
            "examples": [
              "LD-201"
            ]
          },
          "slug": {
            "type": "string"
          },
          "tip": {
            "type": "string",
            "enum": [
              "villa",
              "daire",
              "tas-ev",
              "bungalov",
              "studyo",
              "oda"
            ]
          },
          "baslik": {
            "type": "string"
          },
          "aciklama": {
            "type": "object",
            "properties": {
              "tr": {
                "type": "string"
              },
              "en": {
                "type": "string"
              }
            }
          },
          "kapasite": {
            "type": "object"
          },
          "olanaklar": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "havuz",
                "ozel-havuz",
                "deniz-manzarasi",
                "denize-yakin",
                "klima",
                "wifi",
                "mutfak",
                "otopark",
                "cocuk-dostu",
                "evcil-hayvan",
                "bahce",
                "teras",
                "balkon",
                "barbeku",
                "jakuzi",
                "somine",
                "camasir-makinesi",
                "bulasik-makinesi",
                "tv",
                "calisma-alani",
                "kahvalti",
                "dag-manzarasi"
              ]
            }
          },
          "kurallar": {
            "type": "object"
          },
          "iptalPolitikasi": {
            "type": "string",
            "enum": [
              "esnek",
              "orta",
              "kati"
            ]
          },
          "fiyat": {
            "type": "object",
            "properties": {
              "gecelikTaban": {
                "type": "integer"
              },
              "sezonlar": {
                "type": "array"
              },
              "temizlik": {
                "type": "integer"
              },
              "depozito": {
                "type": "integer"
              },
              "birim": {
                "type": "string",
                "const": "TRY"
              }
            }
          },
          "izin": {
            "type": "object",
            "description": "Turizm amaçlı kiralama izin belgesi (demo: örnek numara)"
          },
          "konum": {
            "$ref": "#/components/schemas/Konum"
          },
          "medya": {
            "type": "object"
          },
          "iletisim": {
            "$ref": "#/components/schemas/Iletisim"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "markdown": {
            "type": "string",
            "format": "uri"
          },
          "teklif": {
            "$ref": "#/components/schemas/Teklif"
          }
        },
        "required": [
          "id",
          "slug",
          "tip",
          "baslik",
          "kapasite",
          "fiyat",
          "konum",
          "url"
        ]
      },
      "KonaklamaListesi": {
        "type": "object",
        "properties": {
          "toplam": {
            "type": "integer"
          },
          "sayfa": {
            "type": "integer"
          },
          "sayfaSayisi": {
            "type": "integer"
          },
          "boyut": {
            "type": "integer"
          },
          "tarih": {
            "type": [
              "object",
              "null"
            ]
          },
          "konaklamalar": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Konaklama"
            }
          }
        }
      },
      "Musaitlik": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "bas": {
            "type": "string",
            "format": "date"
          },
          "bit": {
            "type": "string",
            "format": "date"
          },
          "musait": {
            "type": "boolean"
          },
          "doluGeceler": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "date"
            }
          }
        }
      },
      "Teklif": {
        "type": "object",
        "description": "Fiyat teklifi; rezervasyon DEĞİLDİR. Depozito toplama dahil değildir.",
        "properties": {
          "musait": {
            "type": "boolean"
          },
          "gecerli": {
            "type": "boolean"
          },
          "geceSayisi": {
            "type": "integer"
          },
          "geceDokumu": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "tarih": {
                  "type": "string"
                },
                "tutar": {
                  "type": "integer"
                }
              }
            }
          },
          "konaklamaTL": {
            "type": "integer"
          },
          "temizlikTL": {
            "type": "integer"
          },
          "toplamTL": {
            "type": "integer"
          },
          "depozitoTL": {
            "type": "integer"
          },
          "uyarilar": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Hata": {
        "type": "object",
        "properties": {
          "hata": {
            "type": "string"
          },
          "mesaj": {
            "type": "string"
          }
        },
        "required": [
          "hata",
          "mesaj"
        ]
      },
      "Konum": {
        "type": "object",
        "description": "Konum. hassasiyet \"yaklasik\" ise koordinat bilinçli olarak kaydırılmıştır (kapı numarası paylaşılmaz).",
        "properties": {
          "il": {
            "type": "string"
          },
          "ilce": {
            "type": "string"
          },
          "mahalle": {
            "type": "string"
          },
          "adresMetni": {
            "type": "string"
          },
          "lat": {
            "type": "number"
          },
          "lng": {
            "type": "number"
          },
          "hassasiyet": {
            "type": "string",
            "enum": [
              "tam",
              "yaklasik"
            ]
          },
          "yaklasikYaricapM": {
            "type": "integer"
          }
        }
      },
      "Bolgeler": {
        "type": "object",
        "properties": {
          "bolgeler": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "ad": {
                  "type": "string"
                },
                "il": {
                  "type": "string"
                },
                "sayi": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "Iletisim": {
        "type": "object",
        "properties": {
          "ofis": {
            "type": "string"
          },
          "tel": {
            "type": "string"
          },
          "eposta": {
            "type": "string"
          }
        }
      }
    }
  }
}