{
  "openapi": "3.1.0",
  "info": {
    "title": "Radyo Kutsal Yayın API",
    "version": "1.0.0",
    "description": "Canlı ses (HLS/AAC) + çalan parça meta verisi (now.json) + senkron SRT transkript. Statik dosya + poll mimarisi; kimlik doğrulama yok, CORS açık (*). İnsan dokümantasyonu: https://radyo.akil.cloud/",
    "contact": { "name": "Radyo Kutsal", "url": "https://kutsalkitaplar.org" }
  },
  "servers": [ { "url": "https://radyo.akil.cloud" } ],
  "paths": {
    "/radyo.m3u8": {
      "get": {
        "summary": "Canlı ses HLS playlist'i",
        "description": "Kayan pencereli HLS playlist (AAC 48 kHz stereo, ~4 sn MPEG-TS segment). Safari yerel; diğer tarayıcılar hls.js ile.",
        "responses": {
          "200": {
            "description": "M3U8 playlist",
            "content": { "application/vnd.apple.mpegurl": { "schema": { "type": "string" } } }
          }
        }
      }
    },
    "/now.json": {
      "get": {
        "summary": "Çalan parça meta verisi",
        "description": "Anlık durum; ~2 sn'de güncellenir. İstemci 5-10 sn'de bir poll'lamalı.",
        "responses": {
          "200": {
            "description": "Now playing nesnesi",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NowPlaying" } } }
          }
        }
      }
    },
    "/current.srt": {
      "get": {
        "summary": "Çalan parçanın SRT transkripti",
        "description": "Parça değişince atomik güncellenir. transcript.available=false ise boştur. Parça başına bir kez indir, positionSec ile senkronla.",
        "responses": {
          "200": {
            "description": "SRT metni",
            "content": { "text/plain": { "schema": { "type": "string" } } }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "NowPlaying": {
        "type": "object",
        "required": ["schemaVersion","serverTime","isPlaying","title","positionSec","audio","transcript"],
        "properties": {
          "schemaVersion": { "type": "integer", "const": 1 },
          "serverTime": { "type": "string", "format": "date-time", "description": "positionSec'in geçerli olduğu an (ISO UTC)." },
          "serverTimeLocal": { "type": "string", "description": "İstanbul saati HH:MM:SS." },
          "isPlaying": { "type": "boolean" },
          "title": { "type": "string" },
          "startedAt": { "type": ["string","null"], "format": "date-time" },
          "endsAt": { "type": ["string","null"], "format": "date-time" },
          "endsAtLocal": { "type": "string", "description": "Bitiş İstanbul saati HH:MM." },
          "durationSec": { "type": ["number","null"] },
          "positionSec": { "type": "number", "description": "serverTime anındaki çalma pozisyonu (sn); SRT senkron anahtarı." },
          "remainingSec": { "type": ["number","null"] },
          "audio": {
            "type": "object",
            "properties": {
              "hls": { "type": "string", "format": "uri" },
              "codec": { "type": "string", "examples": ["aac"] },
              "container": { "type": "string", "examples": ["mpegts"] },
              "sampleRate": { "type": "integer", "examples": [48000] },
              "channels": { "type": "integer", "examples": [2] }
            }
          },
          "transcript": {
            "type": "object",
            "properties": {
              "available": { "type": "boolean" },
              "srt": { "type": "string", "format": "uri" },
              "format": { "type": "string", "const": "srt" }
            }
          }
        }
      }
    }
  }
}
