{
  "name": "png2webp",
  "title": "Ravencraft PNG → WebP Service",
  "version": "1.1.0",
  "base_url": "https://services.ravencraft.dk/png2webp",
  "description": "Converts PNG images to WebP. Supports URL-based fetch from an allowlist and direct uploads. Output is cached on disk for 24 hours.",
  "auth": { "type": "none" },
  "constraints": {
    "max_input_bytes": 10485760,
    "cache_ttl_seconds": 86400,
    "allowed_hosts": ["services.ravencraft.dk", "ravencraft.dk"],
    "quality_range": { "min": 0, "max": 100, "default": 80 }
  },
  "endpoints": [
    {
      "method": "GET",
      "path": "/",
      "returns": "image/webp",
      "summary": "Convert a PNG from an allowlisted URL.",
      "query_params": {
        "image_url": { "type": "string", "required": true, "example": "https://services.ravencraft.dk/placeholder?w=320&h=180&format=png" },
        "quality": { "type": "integer", "min": 0, "max": 100, "default": 80 },
        "request_id": { "type": "string" },
        "tenant_id": { "type": "string" },
        "user_id": { "type": "string" }
      }
    },
    {
      "method": "POST",
      "path": "/",
      "returns": "image/webp",
      "summary": "Convert an uploaded PNG file.",
      "body": {
        "type": "multipart/form-data",
        "fields": {
          "png_file": { "type": "file", "content_type": "image/png" },
          "file": { "type": "file", "content_type": "image/png", "note": "Alias of png_file" },
          "quality": { "type": "integer", "min": 0, "max": 100, "default": 80 },
          "request_id": { "type": "string" },
          "tenant_id": { "type": "string" },
          "user_id": { "type": "string" }
        }
      }
    },
    {
      "method": "GET",
      "path": "/ui",
      "returns": "text/html",
      "summary": "Human UI for conversion (rewrite to ui.php)."
    },
    {
      "method": "GET",
      "path": "/health.php",
      "returns": "application/json",
      "summary": "Health check."
    },
    {
      "method": "GET",
      "path": "/manifest.json",
      "returns": "application/json",
      "summary": "Machine-readable service description."
    }
  ],
  "logging": {
    "via": "/shared/log_client.php",
    "events": [
      "png2webp.request",
      "png2webp.ui.redirect",
      "png2webp.served",
      "png2webp.error"
    ]
  }
}
