{
  "openapi": "3.1.0",
  "info": {
    "title": "PikoTV Broadcasting Platform API",
    "description": "PikoTV delivers advanced modular broadcasting solutions including professional video encoders, decoders, OTT platforms, and IPTV/satellite systems. This specification describes the public-facing API surface for integrators and partners.",
    "version": "1.0.0",
    "contact": {
      "name": "PikoTV Support",
      "url": "https://pikotv.com/support",
      "email": "info@pikotv.com"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://pikotv.com/terms-of-service"
    },
    "termsOfService": "https://pikotv.com/terms-of-service"
  },

  "x-mcp-server": {
    "serverCard": "https://pikotv.com/.well-known/mcp/server-card.json",
    "endpoint": "https://mcp.pikotv.com/v1",
    "protocol": "mcp/1.0",
    "description": "MCP server exposing all PikoTV broadcasting platform capabilities. Each path item below carries an x-mcp-tool annotation mapping it to the corresponding MCP tool name. Paths that belong to a named MCP capability also carry an x-mcp-capability annotation.",
    "namedCapabilities": [
      {
        "name": "pikotv.monitoring.rf-nms",
        "tool": "monitoring_rf_nms",
        "paths": ["/monitoring/alarms", "/monitoring/probes", "/monitoring/health"],
        "requiredScopes": ["pikotv:monitoring:read"],
        "subsystem": "sat-nms MNC",
        "vendor": "SatService GmbH",
        "relatedSkills": ["pikotv.rf-nms", "pikotv.rf-nms.api"]
      }
    ]
  },

  "x-agent-skills": {
    "index": "https://pikotv.com/.well-known/agent-skills/index.json",
    "skills": [
      { "name": "pikotv.encoder.query",    "paths": ["/encoder", "/encoder/{encoderId}", "/encoder/{encoderId}/streams", "/encoder/health"] },
      { "name": "pikotv.decoder.query",    "paths": ["/decoder", "/decoder/{decoderId}", "/decoder/health"] },
      { "name": "pikotv.platform.health",  "paths": ["/health"] },
      { "name": "pikotv.ott.channels",     "paths": ["/ott", "/ott/channels", "/ott/health"] },
      { "name": "pikotv.iptv.feeds",       "paths": ["/iptv", "/iptv/feeds", "/iptv/health"] },
      { "name": "pikotv.monitoring.qos",   "paths": ["/monitoring", "/monitoring/probes"] },
      { "name": "pikotv.monitoring.alarms","paths": ["/monitoring/alarms"] },
      { "name": "pikotv.rf-nms.api",       "paths": ["/monitoring/alarms", "/monitoring/probes", "/monitoring/health"] },
      { "name": "pikotv.fast.channels",    "paths": ["/fast", "/fast/channels", "/fast/health"] }
    ]
  },

  "servers": [
    {
      "url": "https://pikotv.com/api/v1",
      "description": "PikoTV Production API v1"
    }
  ],
  "tags": [
    { "name": "Health",     "description": "Service health and status endpoints" },
    { "name": "Encoder",    "description": "Video encoder management and configuration" },
    { "name": "Decoder",    "description": "Video decoder and media gateway management" },
    { "name": "OTT",        "description": "OTT platform operations and partner integrations" },
    { "name": "IPTV",       "description": "IPTV and satellite system management" },
    { "name": "Monitoring", "description": "Real-time QoS/QoE monitoring and RF NMS" },
    { "name": "FAST",       "description": "FAST channel management and monetization" }
  ],
  "paths": {

    "/health": {
      "x-mcp-tool": "get_platform_health",
      "x-agent-skills": ["pikotv.platform.health"],
      "get": {
        "operationId": "getHealth",
        "summary": "Platform health check",
        "description": "Returns the overall health status of the PikoTV broadcasting platform, including all subsystem statuses.",
        "tags": ["Health"],
        "responses": {
          "200": {
            "description": "Platform is healthy",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/HealthResponse" },
                "example": {
                  "status": "ok",
                  "version": "1.0.0",
                  "timestamp": "2026-04-20T00:00:00Z",
                  "subsystems": {
                    "encoder": "ok",
                    "decoder": "ok",
                    "ott": "ok",
                    "iptv": "ok",
                    "monitoring": "ok",
                    "fast": "ok"
                  }
                }
              }
            }
          },
          "503": {
            "description": "One or more subsystems are degraded",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/HealthResponse" }
              }
            }
          }
        }
      }
    },

    "/encoder": {
      "x-mcp-tool": "list_encoders",
      "x-agent-skills": ["pikotv.encoder.query"],
      "get": {
        "operationId": "listEncoders",
        "summary": "List encoder instances",
        "description": "Returns a list of all configured encoder and transcoder instances. Supports AV1, VVC, HEVC, AVC, MPEG-2/4, EVC, and LCEVC codecs.",
        "tags": ["Encoder"],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "description": "Filter by encoder status",
            "schema": { "type": "string", "enum": ["active", "idle", "error", "all"] }
          },
          {
            "name": "codec",
            "in": "query",
            "description": "Filter by output codec",
            "schema": { "type": "string", "enum": ["AV1", "VVC", "HEVC", "AVC", "MPEG2", "MPEG4", "EVC", "LCEVC"] }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": { "type": "integer", "default": 20, "maximum": 100 }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": { "type": "integer", "default": 0 }
          }
        ],
        "responses": {
          "200": {
            "description": "List of encoder instances",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "total": { "type": "integer" },
                    "items": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/EncoderInstance" }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },

    "/encoder/health": {
      "x-mcp-tool": "get_platform_health",
      "x-agent-skills": ["pikotv.encoder.query", "pikotv.platform.health"],
      "get": {
        "operationId": "getEncoderHealth",
        "summary": "Encoder subsystem health",
        "description": "Returns health and performance metrics for the encoder subsystem.",
        "tags": ["Encoder", "Health"],
        "responses": {
          "200": {
            "description": "Encoder subsystem health status",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SubsystemHealth" }
              }
            }
          }
        }
      }
    },

    "/encoder/{encoderId}": {
      "x-mcp-tool": "get_encoder",
      "x-agent-skills": ["pikotv.encoder.query"],
      "get": {
        "operationId": "getEncoder",
        "summary": "Get encoder instance details",
        "description": "Returns full configuration and runtime status for a specific encoder instance.",
        "tags": ["Encoder"],
        "parameters": [
          {
            "name": "encoderId",
            "in": "path",
            "required": true,
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "Encoder instance details",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/EncoderInstance" }
              }
            }
          },
          "404": { "description": "Encoder not found" }
        }
      }
    },

    "/encoder/{encoderId}/streams": {
      "x-mcp-tool": "get_encoder",
      "x-agent-skills": ["pikotv.encoder.query"],
      "get": {
        "operationId": "listEncoderStreams",
        "summary": "List active streams for an encoder",
        "description": "Returns all active output streams for a given encoder instance, including bitrate, resolution, and codec details.",
        "tags": ["Encoder"],
        "parameters": [
          {
            "name": "encoderId",
            "in": "path",
            "required": true,
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "List of active streams",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": { "$ref": "#/components/schemas/StreamInfo" }
                }
              }
            }
          }
        }
      }
    },

    "/decoder": {
      "x-mcp-tool": "list_decoders",
      "x-agent-skills": ["pikotv.decoder.query"],
      "get": {
        "operationId": "listDecoders",
        "summary": "List decoder instances",
        "description": "Returns a list of all configured decoder and media gateway instances. Supports DVB-S/S2/S2X satellite inputs, SDI/HDMI/IP outputs.",
        "tags": ["Decoder"],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": { "type": "string", "enum": ["active", "idle", "error", "all"] }
          },
          {
            "name": "inputType",
            "in": "query",
            "description": "Filter by input type",
            "schema": { "type": "string", "enum": ["DVB-S", "DVB-S2", "DVB-S2X", "IP", "ASI", "SDI", "HDMI"] }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": { "type": "integer", "default": 20, "maximum": 100 }
          }
        ],
        "responses": {
          "200": {
            "description": "List of decoder instances",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "total": { "type": "integer" },
                    "items": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/DecoderInstance" }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },

    "/decoder/health": {
      "x-mcp-tool": "get_platform_health",
      "x-agent-skills": ["pikotv.decoder.query", "pikotv.platform.health"],
      "get": {
        "operationId": "getDecoderHealth",
        "summary": "Decoder subsystem health",
        "description": "Returns health and performance metrics for the decoder subsystem.",
        "tags": ["Decoder", "Health"],
        "responses": {
          "200": {
            "description": "Decoder subsystem health status",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SubsystemHealth" }
              }
            }
          }
        }
      }
    },

    "/decoder/{decoderId}": {
      "x-mcp-tool": "list_decoders",
      "x-agent-skills": ["pikotv.decoder.query"],
      "get": {
        "operationId": "getDecoder",
        "summary": "Get decoder instance details",
        "description": "Returns full configuration and runtime status for a specific decoder instance, including satellite input parameters and output port assignments.",
        "tags": ["Decoder"],
        "parameters": [
          {
            "name": "decoderId",
            "in": "path",
            "required": true,
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "Decoder instance details",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/DecoderInstance" }
              }
            }
          },
          "404": { "description": "Decoder not found" }
        }
      }
    },

    "/ott": {
      "x-mcp-tool": "list_ott_channels",
      "x-agent-skills": ["pikotv.ott.channels"],
      "get": {
        "operationId": "getOTTPlatformStatus",
        "summary": "OTT platform status",
        "description": "Returns the current status of the OTT platform, including active sessions, CDN health, and partner platform integrations (Morescreens, UniqCast, Vucos).",
        "tags": ["OTT"],
        "responses": {
          "200": {
            "description": "OTT platform status",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/OTTPlatformStatus" }
              }
            }
          }
        }
      }
    },

    "/ott/health": {
      "x-mcp-tool": "get_platform_health",
      "x-agent-skills": ["pikotv.ott.channels", "pikotv.platform.health"],
      "get": {
        "operationId": "getOTTHealth",
        "summary": "OTT subsystem health",
        "description": "Returns health metrics for the OTT platform subsystem, including CDN availability and DRM service status.",
        "tags": ["OTT", "Health"],
        "responses": {
          "200": {
            "description": "OTT subsystem health",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SubsystemHealth" }
              }
            }
          }
        }
      }
    },

    "/ott/channels": {
      "x-mcp-tool": "list_ott_channels",
      "x-agent-skills": ["pikotv.ott.channels"],
      "get": {
        "operationId": "listOTTChannels",
        "summary": "List OTT channels",
        "description": "Returns all configured OTT channels including live, VOD, and FAST channels with their packaging and DRM configuration.",
        "tags": ["OTT"],
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "schema": { "type": "string", "enum": ["live", "vod", "fast", "all"] }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": { "type": "integer", "default": 50, "maximum": 200 }
          }
        ],
        "responses": {
          "200": {
            "description": "List of OTT channels",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "total": { "type": "integer" },
                    "items": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/OTTChannel" }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },

    "/iptv": {
      "x-mcp-tool": "list_iptv_feeds",
      "x-agent-skills": ["pikotv.iptv.feeds"],
      "get": {
        "operationId": "getIPTVStatus",
        "summary": "IPTV/satellite system status",
        "description": "Returns the current status of the IPTV and satellite delivery system, including DVB-NIP gateway status and active satellite feeds.",
        "tags": ["IPTV"],
        "responses": {
          "200": {
            "description": "IPTV system status",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/IPTVStatus" }
              }
            }
          }
        }
      }
    },

    "/iptv/health": {
      "x-mcp-tool": "get_platform_health",
      "x-agent-skills": ["pikotv.iptv.feeds", "pikotv.platform.health"],
      "get": {
        "operationId": "getIPTVHealth",
        "summary": "IPTV subsystem health",
        "description": "Returns health metrics for the IPTV and satellite subsystem, including signal quality and gateway availability.",
        "tags": ["IPTV", "Health"],
        "responses": {
          "200": {
            "description": "IPTV subsystem health",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SubsystemHealth" }
              }
            }
          }
        }
      }
    },

    "/iptv/feeds": {
      "x-mcp-tool": "list_iptv_feeds",
      "x-agent-skills": ["pikotv.iptv.feeds"],
      "get": {
        "operationId": "listIPTVFeeds",
        "summary": "List satellite and IP feeds",
        "description": "Returns all configured satellite and IP input feeds, including DVB-S/S2/S2X parameters, transponder details, and signal quality metrics.",
        "tags": ["IPTV"],
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "schema": { "type": "string", "enum": ["dvb-s", "dvb-s2", "dvb-s2x", "ip", "all"] }
          }
        ],
        "responses": {
          "200": {
            "description": "List of input feeds",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": { "$ref": "#/components/schemas/IPTVFeed" }
                }
              }
            }
          }
        }
      }
    },

    "/monitoring": {
      "x-mcp-tool": "get_monitoring_overview",
      "x-agent-skills": ["pikotv.monitoring.qos"],
      "get": {
        "operationId": "getMonitoringOverview",
        "summary": "Monitoring dashboard overview",
        "description": "Returns a summary of all active monitoring probes, current QoS/QoE metrics, and active alarms across the platform.",
        "tags": ["Monitoring"],
        "responses": {
          "200": {
            "description": "Monitoring overview",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/MonitoringOverview" }
              }
            }
          }
        }
      }
    },

    "/monitoring/health": {
      "x-mcp-tool": "monitoring_rf_nms",
      "x-mcp-capability": "pikotv.monitoring.rf-nms",
      "x-mcp-capability-action": "get_health",
      "x-agent-skills": ["pikotv.rf-nms.api", "pikotv.platform.health"],
      "get": {
        "operationId": "getMonitoringHealth",
        "summary": "Monitoring subsystem health",
        "description": "Returns health status of the monitoring subsystem, including Elecard Boro probe connectivity and sat-nms RF NMS availability. This path is the backing endpoint for the 'get_health' action of the 'monitoring_rf_nms' MCP tool (capability: pikotv.monitoring.rf-nms).",
        "tags": ["Monitoring", "Health"],
        "responses": {
          "200": {
            "description": "Monitoring subsystem health",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SubsystemHealth" }
              }
            }
          }
        }
      }
    },

    "/monitoring/probes": {
      "x-mcp-tool": "monitoring_rf_nms",
      "x-mcp-capability": "pikotv.monitoring.rf-nms",
      "x-mcp-capability-action": "get_probes",
      "x-agent-skills": ["pikotv.rf-nms.api", "pikotv.monitoring.qos"],
      "get": {
        "operationId": "listMonitoringProbes",
        "summary": "List monitoring probes",
        "description": "Returns all configured QoS/QoE monitoring probes with their current status, measured streams, and alarm thresholds. When called via the 'monitoring_rf_nms' MCP tool (action: get_probes, capability: pikotv.monitoring.rf-nms), results are scoped to sat-nms MNC-attached probes and include per-probe RF signal metrics (TR 101 290, CC errors, IAT, PSNR, loudness).",
        "tags": ["Monitoring"],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": { "type": "string", "enum": ["active", "alarm", "offline", "all"] }
          },
          {
            "name": "probeId",
            "in": "query",
            "description": "Optional sat-nms probe identifier to scope results to a single probe (used by monitoring_rf_nms MCP tool).",
            "schema": { "type": "string" }
          },
          {
            "name": "since",
            "in": "query",
            "description": "ISO 8601 timestamp — return probe snapshots since this time (used by monitoring_rf_nms MCP tool).",
            "schema": { "type": "string", "format": "date-time" }
          }
        ],
        "responses": {
          "200": {
            "description": "List of monitoring probes",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": { "$ref": "#/components/schemas/MonitoringProbe" }
                }
              }
            }
          }
        }
      }
    },

    "/monitoring/alarms": {
      "x-mcp-tool": "monitoring_rf_nms",
      "x-mcp-capability": "pikotv.monitoring.rf-nms",
      "x-mcp-capability-action": "get_alarms",
      "x-agent-skills": ["pikotv.rf-nms.api", "pikotv.monitoring.alarms"],
      "get": {
        "operationId": "listAlarms",
        "summary": "List active alarms",
        "description": "Returns all active and recent alarms from QoS/QoE monitoring and RF NMS, with severity, source, and timestamp. This path is the primary backing endpoint for the 'monitoring_rf_nms' MCP tool (action: get_alarms, capability: pikotv.monitoring.rf-nms) — prefer that tool over the generic 'list_alarms' tool when agent intent is specifically about satellite ground station health, waveguide switch state, IO-FEP relay outputs, or sat-nms MNC alarm streams.",
        "tags": ["Monitoring"],
        "parameters": [
          {
            "name": "severity",
            "in": "query",
            "schema": { "type": "string", "enum": ["critical", "major", "minor", "warning", "all"] }
          },
          {
            "name": "since",
            "in": "query",
            "description": "ISO 8601 timestamp — return alarms since this time",
            "schema": { "type": "string", "format": "date-time" }
          }
        ],
        "responses": {
          "200": {
            "description": "List of alarms",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": { "$ref": "#/components/schemas/Alarm" }
                }
              }
            }
          }
        }
      }
    },

    "/fast": {
      "x-mcp-tool": "list_fast_channels",
      "x-agent-skills": ["pikotv.fast.channels"],
      "get": {
        "operationId": "getFASTStatus",
        "summary": "FAST channel platform status",
        "description": "Returns the current status of the FAST channel platform, including active channels, ad insertion status, and distribution platform connections.",
        "tags": ["FAST"],
        "responses": {
          "200": {
            "description": "FAST platform status",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/FASTStatus" }
              }
            }
          }
        }
      }
    },

    "/fast/health": {
      "x-mcp-tool": "get_platform_health",
      "x-agent-skills": ["pikotv.fast.channels", "pikotv.platform.health"],
      "get": {
        "operationId": "getFASTHealth",
        "summary": "FAST subsystem health",
        "description": "Returns health metrics for the FAST channel subsystem, including SSAI ad server connectivity and SoFast platform status.",
        "tags": ["FAST", "Health"],
        "responses": {
          "200": {
            "description": "FAST subsystem health",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SubsystemHealth" }
              }
            }
          }
        }
      }
    },

    "/fast/channels": {
      "x-mcp-tool": "list_fast_channels",
      "x-agent-skills": ["pikotv.fast.channels"],
      "get": {
        "operationId": "listFASTChannels",
        "summary": "List FAST channels",
        "description": "Returns all configured FAST channels with their distribution platform assignments, ad insertion configuration, and current viewer metrics.",
        "tags": ["FAST"],
        "parameters": [
          {
            "name": "platform",
            "in": "query",
            "description": "Filter by distribution platform",
            "schema": { "type": "string" }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": { "type": "integer", "default": 50, "maximum": 200 }
          }
        ],
        "responses": {
          "200": {
            "description": "List of FAST channels",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "total": { "type": "integer" },
                    "items": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/FASTChannel" }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }

  },

  "components": {
    "schemas": {
      "HealthResponse": {
        "type": "object",
        "properties": {
          "status": { "type": "string", "enum": ["ok", "degraded", "error"] },
          "version": { "type": "string" },
          "timestamp": { "type": "string", "format": "date-time" },
          "subsystems": {
            "type": "object",
            "additionalProperties": { "type": "string", "enum": ["ok", "degraded", "error"] }
          }
        },
        "required": ["status", "timestamp"]
      },
      "SubsystemHealth": {
        "type": "object",
        "properties": {
          "status": { "type": "string", "enum": ["ok", "degraded", "error"] },
          "subsystem": { "type": "string" },
          "timestamp": { "type": "string", "format": "date-time" },
          "metrics": {
            "type": "object",
            "additionalProperties": true
          },
          "message": { "type": "string" }
        },
        "required": ["status", "subsystem", "timestamp"]
      },
      "EncoderInstance": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "status": { "type": "string", "enum": ["active", "idle", "error"] },
          "codec": { "type": "string", "enum": ["AV1", "VVC", "HEVC", "AVC", "MPEG2", "MPEG4", "EVC", "LCEVC"] },
          "profile": { "type": "string" },
          "resolution": { "type": "string", "example": "3840x2160" },
          "framerate": { "type": "number", "example": 60 },
          "bitrate_kbps": { "type": "integer" },
          "mode": { "type": "string", "enum": ["CBR", "VBR", "CVBR", "ABR"] },
          "input": { "type": "string" },
          "output": { "type": "string" },
          "uptime_seconds": { "type": "integer" },
          "created_at": { "type": "string", "format": "date-time" }
        },
        "required": ["id", "status", "codec"]
      },
      "DecoderInstance": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "status": { "type": "string", "enum": ["active", "idle", "error"] },
          "input_type": { "type": "string", "enum": ["DVB-S", "DVB-S2", "DVB-S2X", "IP", "ASI", "SDI", "HDMI"] },
          "output_ports": {
            "type": "array",
            "items": { "type": "string", "enum": ["SDI", "HDMI", "DVI", "12G-SDI", "IP", "ASI"] }
          },
          "satellite": {
            "type": "object",
            "properties": {
              "frequency_mhz": { "type": "number" },
              "symbol_rate_msps": { "type": "number" },
              "polarization": { "type": "string", "enum": ["H", "V", "L", "R"] },
              "fec": { "type": "string" },
              "signal_level_dbm": { "type": "number" },
              "snr_db": { "type": "number" }
            }
          },
          "uptime_seconds": { "type": "integer" },
          "created_at": { "type": "string", "format": "date-time" }
        },
        "required": ["id", "status", "input_type"]
      },
      "StreamInfo": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "codec": { "type": "string" },
          "resolution": { "type": "string" },
          "bitrate_kbps": { "type": "integer" },
          "framerate": { "type": "number" },
          "protocol": { "type": "string", "enum": ["HLS", "DASH", "CMAF", "SRT", "RIST", "UDP", "RTP"] },
          "url": { "type": "string" },
          "drm": { "type": "string", "enum": ["none", "PlayReady", "Widevine", "FairPlay", "CENC"] }
        }
      },
      "OTTPlatformStatus": {
        "type": "object",
        "properties": {
          "status": { "type": "string", "enum": ["ok", "degraded", "error"] },
          "active_sessions": { "type": "integer" },
          "cdn_status": { "type": "string" },
          "drm_status": { "type": "string" },
          "partners": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": { "type": "string" },
                "status": { "type": "string" }
              }
            }
          },
          "timestamp": { "type": "string", "format": "date-time" }
        }
      },
      "OTTChannel": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "type": { "type": "string", "enum": ["live", "vod", "fast"] },
          "status": { "type": "string", "enum": ["active", "inactive", "error"] },
          "packaging": { "type": "string", "enum": ["HLS", "DASH", "CMAF"] },
          "drm": { "type": "string", "enum": ["none", "PlayReady", "Widevine", "FairPlay", "CENC"] },
          "cdn_url": { "type": "string" },
          "active_viewers": { "type": "integer" }
        }
      },
      "IPTVStatus": {
        "type": "object",
        "properties": {
          "status": { "type": "string", "enum": ["ok", "degraded", "error"] },
          "active_feeds": { "type": "integer" },
          "gateway_status": { "type": "string" },
          "timestamp": { "type": "string", "format": "date-time" }
        }
      },
      "IPTVFeed": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "type": { "type": "string", "enum": ["dvb-s", "dvb-s2", "dvb-s2x", "ip"] },
          "status": { "type": "string", "enum": ["active", "error", "no-signal"] },
          "frequency_mhz": { "type": "number" },
          "symbol_rate_msps": { "type": "number" },
          "polarization": { "type": "string" },
          "fec": { "type": "string" },
          "signal_level_dbm": { "type": "number" },
          "snr_db": { "type": "number" },
          "ber": { "type": "number" }
        }
      },
      "MonitoringOverview": {
        "type": "object",
        "properties": {
          "total_probes": { "type": "integer" },
          "active_probes": { "type": "integer" },
          "active_alarms": { "type": "integer" },
          "critical_alarms": { "type": "integer" },
          "qos_summary": {
            "type": "object",
            "properties": {
              "avg_bitrate_kbps": { "type": "number" },
              "packet_loss_pct": { "type": "number" },
              "avg_latency_ms": { "type": "number" }
            }
          },
          "timestamp": { "type": "string", "format": "date-time" }
        }
      },
      "MonitoringProbe": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "status": { "type": "string", "enum": ["active", "alarm", "offline"] },
          "stream_url": { "type": "string" },
          "protocol": { "type": "string" },
          "qos": {
            "type": "object",
            "properties": {
              "bitrate_kbps": { "type": "number" },
              "packet_loss_pct": { "type": "number" },
              "cc_errors": { "type": "integer" },
              "iat_ms": { "type": "number" },
              "tr101290_p1_errors": { "type": "integer" },
              "tr101290_p2_errors": { "type": "integer" }
            }
          },
          "qoe": {
            "type": "object",
            "properties": {
              "freeze_count": { "type": "integer" },
              "psnr_db": { "type": "number" },
              "audio_loudness_lufs": { "type": "number" }
            }
          },
          "last_updated": { "type": "string", "format": "date-time" }
        }
      },
      "Alarm": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "severity": { "type": "string", "enum": ["critical", "major", "minor", "warning"] },
          "source": { "type": "string" },
          "subsystem": { "type": "string" },
          "message": { "type": "string" },
          "active": { "type": "boolean" },
          "triggered_at": { "type": "string", "format": "date-time" },
          "resolved_at": { "type": "string", "format": "date-time", "nullable": true }
        }
      },
      "FASTStatus": {
        "type": "object",
        "properties": {
          "status": { "type": "string", "enum": ["ok", "degraded", "error"] },
          "active_channels": { "type": "integer" },
          "distribution_platforms": { "type": "integer" },
          "ssai_status": { "type": "string" },
          "timestamp": { "type": "string", "format": "date-time" }
        }
      },
      "FASTChannel": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "status": { "type": "string", "enum": ["active", "inactive", "error"] },
          "platforms": {
            "type": "array",
            "items": { "type": "string" }
          },
          "ssai_enabled": { "type": "boolean" },
          "monetization_model": { "type": "string", "enum": ["AVOD", "FAST", "hybrid"] },
          "active_viewers": { "type": "integer" },
          "ad_fill_rate_pct": { "type": "number" }
        }
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "Static API key issued by PikoTV for server-to-server integrations. Pass in the X-API-Key request header."
      },
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "JWT access token obtained from the PikoTV OAuth 2.0 / OpenID Connect authorization server at https://auth.pikotv.com. Discovery: https://auth.pikotv.com/.well-known/openid-configuration"
      },
      "OAuth2": {
        "type": "oauth2",
        "description": "OAuth 2.0 authorization via the PikoTV authorization server. Discovery document: https://auth.pikotv.com/.well-known/openid-configuration",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://auth.pikotv.com/oauth2/authorize",
            "tokenUrl": "https://auth.pikotv.com/oauth2/token",
            "refreshUrl": "https://auth.pikotv.com/oauth2/token",
            "scopes": {
              "openid": "OpenID Connect identity token",
              "profile": "User profile information",
              "email": "User email address",
              "offline_access": "Refresh token for long-lived access",
              "pikotv:encoder:read": "Read encoder configuration and status",
              "pikotv:encoder:write": "Modify encoder configuration",
              "pikotv:decoder:read": "Read decoder configuration and status",
              "pikotv:decoder:write": "Modify decoder configuration",
              "pikotv:ott:read": "Read OTT platform status and channels",
              "pikotv:ott:write": "Manage OTT channels and configuration",
              "pikotv:iptv:read": "Read IPTV/satellite feed status",
              "pikotv:iptv:write": "Manage IPTV/satellite configuration",
              "pikotv:monitoring:read": "Read QoS/QoE monitoring data and alarms",
              "pikotv:fast:read": "Read FAST channel status and metrics",
              "pikotv:fast:write": "Manage FAST channels and ad insertion",
              "pikotv:admin": "Full administrative access to all subsystems"
            }
          },
          "clientCredentials": {
            "tokenUrl": "https://auth.pikotv.com/oauth2/token",
            "scopes": {
              "pikotv:encoder:read": "Read encoder configuration and status",
              "pikotv:encoder:write": "Modify encoder configuration",
              "pikotv:decoder:read": "Read decoder configuration and status",
              "pikotv:decoder:write": "Modify decoder configuration",
              "pikotv:ott:read": "Read OTT platform status and channels",
              "pikotv:ott:write": "Manage OTT channels and configuration",
              "pikotv:iptv:read": "Read IPTV/satellite feed status",
              "pikotv:iptv:write": "Manage IPTV/satellite configuration",
              "pikotv:monitoring:read": "Read QoS/QoE monitoring data and alarms",
              "pikotv:fast:read": "Read FAST channel status and metrics",
              "pikotv:fast:write": "Manage FAST channels and ad insertion",
              "pikotv:admin": "Full administrative access to all subsystems"
            }
          },
          "deviceCode": {
            "tokenUrl": "https://auth.pikotv.com/oauth2/token",
            "scopes": {
              "openid": "OpenID Connect identity token",
              "profile": "User profile information",
              "email": "User email address",
              "offline_access": "Refresh token for long-lived access",
              "pikotv:encoder:read": "Read encoder configuration and status",
              "pikotv:decoder:read": "Read decoder configuration and status",
              "pikotv:ott:read": "Read OTT platform status and channels",
              "pikotv:monitoring:read": "Read QoS/QoE monitoring data and alarms"
            }
          }
        }
      },
      "OpenIDConnect": {
        "type": "openIdConnect",
        "openIdConnectUrl": "https://auth.pikotv.com/.well-known/openid-configuration",
        "description": "OpenID Connect discovery. Agents can fetch the openIdConnectUrl to programmatically discover all authorization, token, JWKS, and userinfo endpoints."
      }
    }
  },
  "security": [
    { "ApiKeyAuth": [] },
    { "BearerAuth": [] },
    { "OpenIDConnect": [] }
  ],
  "externalDocs": {
    "description": "Full PikoTV API Documentation",
    "url": "https://pikotv.com/docs/api"
  }
}
