{
  "openapi": "3.0.3",
  "info": {
    "title": "Secudox API",
    "description": "Lost & found platform API — items, sightings, claims, rewards (Paystack escrow), ratings, identity verification, smart matching.\n\n**Authentication:** Supabase Auth JWT. Send `Authorization: Bearer <access_token>` on authenticated endpoints.\n\n**Response envelope:** all endpoints return `{ \"success\": boolean, \"data\"?: any, \"error\"?: { \"message\": string } }`.",
    "version": "1.0.0",
    "contact": { "email": "support@secudox.com" }
  },
  "servers": [
    { "url": "https://secudox.co.ke", "description": "Production" },
    { "url": "http://localhost:3000", "description": "Local development" }
  ],
  "tags": [
    { "name": "Auth", "description": "Use the Supabase Kotlin/JS SDK directly for sign-up, sign-in and password reset." },
    { "name": "Items", "description": "Lost & found listings. New posts enter admin moderation (status=pending) before going public." },
    { "name": "Images", "description": "Item image uploads (Supabase storage)." },
    { "name": "Matching", "description": "Automatic lost↔found matching suggestions." },
    { "name": "Sightings", "description": "Reports that an item/person was spotted. Start unverified; admins verify." },
    { "name": "Missing Persons", "description": "Missing people reports with person details." },
    { "name": "Claims", "description": "Ownership claims on found items, with proof uploads." },
    { "name": "Disputes", "description": "Disputes over claim decisions." },
    { "name": "Ratings", "description": "Owner↔finder reputation after a return." },
    { "name": "Identity Verification", "description": "KYC required before receiving reward payouts." },
    { "name": "Payments", "description": "Paystack reward escrow: owner funds → held → released to finder on verified return." },
    { "name": "Reports", "description": "Two-way abuse/safety reporting on any target." },
    { "name": "Notifications", "description": "In-app notifications + FCM push token registration." },
    { "name": "Locations", "description": "Locations and proximity alert subscriptions." },
    { "name": "Users", "description": "Profiles, avatars, passwords, account deletion requests." },
    { "name": "Misc", "description": "Categories, contact form, maintenance jobs." }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT" }
    },
    "schemas": {
      "Envelope": {
        "type": "object",
        "properties": { "success": { "type": "boolean" }, "data": {}, "error": { "type": "object", "properties": { "message": { "type": "string" } } } }
      },
      "Pagination": {
        "type": "object",
        "properties": { "page": { "type": "integer" }, "limit": { "type": "integer" }, "total": { "type": "integer" } }
      },
      "Category": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" } } },
      "Location": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "label": { "type": "string" },
          "city": { "type": "string" },
          "country": { "type": "string" },
          "latitude": { "type": "number" },
          "longitude": { "type": "number" }
        }
      },
      "ItemImage": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "itemId": { "type": "string", "format": "uuid" },
          "imageUrl": { "type": "string", "format": "uri" },
          "isPrimary": { "type": "boolean" },
          "uploadedAt": { "type": "string", "format": "date-time" }
        }
      },
      "Item": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "userId": { "type": "string", "format": "uuid" },
          "type": { "type": "string", "enum": ["lost", "found"] },
          "title": { "type": "string" },
          "description": { "type": "string" },
          "status": { "type": "string", "enum": ["pending", "active", "pending_claim", "claimed", "resolved", "expired", "found_safe", "investigating", "rejected"] },
          "rewardAmount": { "type": "number" },
          "dateOccurred": { "type": "string", "format": "date" },
          "expiresAt": { "type": "string", "format": "date-time", "description": "Listings auto-expire 30 days after creation." },
          "category": { "$ref": "#/components/schemas/Category" },
          "location": { "$ref": "#/components/schemas/Location" },
          "images": { "type": "array", "items": { "$ref": "#/components/schemas/ItemImage" } },
          "createdAt": { "type": "string", "format": "date-time" }
        }
      },
      "MatchCandidate": {
        "type": "object",
        "properties": {
          "matchedItemId": { "type": "string", "format": "uuid" },
          "title": { "type": "string" },
          "score": { "type": "integer", "description": "0–100: text 40 + location 35 + date 25" },
          "breakdown": { "type": "object", "properties": { "text": { "type": "integer" }, "location": { "type": "integer" }, "date": { "type": "integer" } } },
          "lostItemId": { "type": "string", "format": "uuid" },
          "foundItemId": { "type": "string", "format": "uuid" }
        }
      },
      "Sighting": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "itemId": { "type": "string", "format": "uuid" },
          "reporterId": { "type": "string", "format": "uuid" },
          "locationLabel": { "type": "string" },
          "sightedAt": { "type": "string", "format": "date-time" },
          "description": { "type": "string" },
          "status": { "type": "string", "enum": ["unverified", "verified", "dismissed"], "description": "Admins verify sightings before owners are notified." }
        }
      },
      "Claim": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "itemId": { "type": "string", "format": "uuid" },
          "claimantId": { "type": "string", "format": "uuid" },
          "description": { "type": "string" },
          "status": { "type": "string", "enum": ["submitted", "under_review", "approved", "rejected", "disputed"] }
        }
      },
      "Rating": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "itemId": { "type": "string", "format": "uuid" },
          "rateeId": { "type": "string", "format": "uuid" },
          "role": { "type": "string", "enum": ["owner", "finder"] },
          "score": { "type": "integer", "minimum": 1, "maximum": 5 },
          "comment": { "type": "string" }
        }
      },
      "Payment": {
        "type": "object",
        "properties": {
          "id": { "type": "string", "format": "uuid" },
          "itemId": { "type": "string", "format": "uuid" },
          "amount": { "type": "integer", "description": "KES" },
          "status": { "type": "string", "enum": ["initialized", "funded", "held", "released", "refunded", "failed"] },
          "checkoutUrl": { "type": "string", "format": "uri", "description": "Paystack hosted checkout — redirect the payer here." },
          "providerReference": { "type": "string" }
        }
      }
    },
    "responses": {
      "Unauthorized": { "description": "Missing/invalid token", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Envelope" } } } },
      "Forbidden": { "description": "Not allowed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Envelope" } } } },
      "NotFound": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Envelope" } } } }
    }
  },
  "paths": {
    "/api/categories": {
      "get": { "tags": ["Misc"], "summary": "List item categories", "security": [], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Envelope" } } } } } }
    },
    "/api/locations": {
      "get": { "tags": ["Misc"], "summary": "List known locations", "security": [], "responses": { "200": { "description": "OK" } } }
    },
    "/api/items": {
      "get": {
        "tags": ["Items"], "summary": "Search / list items", "security": [],
        "parameters": [
          { "name": "type", "in": "query", "schema": { "type": "string", "enum": ["lost", "found"] } },
          { "name": "category_id", "in": "query", "schema": { "type": "string" } },
          { "name": "category_name", "in": "query", "schema": { "type": "string" } },
          { "name": "city", "in": "query", "schema": { "type": "string" } },
          { "name": "query", "in": "query", "schema": { "type": "string" }, "description": "Full-text search (websearch syntax)" },
          { "name": "user_id", "in": "query", "schema": { "type": "string", "format": "uuid" } },
          { "name": "expires_soon", "in": "query", "schema": { "type": "boolean" }, "description": "Items expiring within 7 days" },
          { "name": "sort", "in": "query", "schema": { "type": "string", "default": "created_at" } },
          { "name": "page", "in": "query", "schema": { "type": "integer", "default": 1 } },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "default": 12, "maximum": 50 } }
        ],
        "responses": { "200": { "description": "Paginated items", "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/Envelope" }], "properties": { "data": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/Item" } }, "total": { "type": "integer" } } } } } } } } }
      },
      "post": {
        "tags": ["Items"], "summary": "Report a lost/found item", "security": [{ "bearerAuth": [] }],
        "description": "Creates item with status `pending` and queues it for admin moderation. Owner funds reward separately via Payments.",
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": {
            "type": "object",
            "required": ["title", "type", "categoryId", "description", "dateOccurred"],
            "properties": {
              "title": { "type": "string" },
              "type": { "type": "string", "enum": ["lost", "found"] },
              "categoryId": { "type": "string" },
              "description": { "type": "string" },
              "dateOccurred": { "type": "string", "format": "date" },
              "locationLabel": { "type": "string" },
              "latitude": { "type": "number" },
              "longitude": { "type": "number" },
              "rewardAmount": { "type": "number", "description": "KES" },
              "paymentMethod": { "type": "string", "enum": ["card", "mpesa"] },
              "payerPhone": { "type": "string" }
            }
          } } }
        },
        "responses": { "201": { "description": "Created", "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/Envelope" }], "properties": { "data": { "$ref": "#/components/schemas/Item" } } } } } }, "400": { "$ref": "#/components/responses/Unauthorized" }, "401": { "$ref": "#/components/responses/Unauthorized" } }
      }
    },
    "/api/items/{id}": {
      "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
      "get": { "tags": ["Items"], "summary": "Item detail with images", "security": [], "responses": { "200": { "description": "OK" }, "404": { "$ref": "#/components/responses/NotFound" } } },
      "patch": {
        "tags": ["Items"], "summary": "Update item (owner or admin)", "security": [{ "bearerAuth": [] }],
        "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "title": { "type": "string" }, "description": { "type": "string" }, "status": { "type": "string" }, "rewardAmount": { "type": "number" }, "categoryId": { "type": "string" }, "dateOccurred": { "type": "string", "format": "date" } } } } } },
        "responses": { "200": { "description": "Updated" }, "403": { "$ref": "#/components/responses/Forbidden" } }
      },
      "delete": { "tags": ["Items"], "summary": "Delete item (owner or admin)", "security": [{ "bearerAuth": [] }], "responses": { "200": { "description": "Deleted" }, "403": { "$ref": "#/components/responses/Forbidden" } } }
    },
    "/api/items/{id}/images": {
      "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
      "post": {
        "tags": ["Images"], "summary": "Upload item images", "security": [{ "bearerAuth": [] }],
        "requestBody": { "required": true, "content": { "multipart/form-data": { "schema": { "type": "object", "properties": { "files": { "type": "array", "items": { "type": "string", "format": "binary" }, "description": "Repeatable field. First image becomes primary." } } } } } },
        "responses": { "201": { "description": "Uploaded URLs", "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/Envelope" }], "properties": { "data": { "type": "array", "items": { "type": "string", "format": "uri" } } } } } } } }
      }
    },
    "/api/items/{id}/matches": {
      "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
      "get": {
        "tags": ["Matching"], "summary": "Compute lost↔found matches", "security": [{ "bearerAuth": [] }],
        "description": "Scores candidates: text similarity (40) + location within 25km (35) + date within ±14 days (25). Results ≥30 persisted as suggestions; owner notified.",
        "responses": { "200": { "description": "Matches", "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/Envelope" }], "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/MatchCandidate" } } } } } } } }
      }
    },
    "/api/sightings": {
      "get": {
        "tags": ["Sightings"], "summary": "List sightings for an item", "security": [],
        "parameters": [
          { "name": "item_id", "in": "query", "required": true, "schema": { "type": "string", "format": "uuid" } },
          { "name": "page", "in": "query", "schema": { "type": "integer" } },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "maximum": 50 } }
        ],
        "responses": { "200": { "description": "OK" } }
      },
      "post": {
        "tags": ["Sightings"], "summary": "Report a sighting (found/spotted)", "security": [{ "bearerAuth": [] }],
        "description": "Created with status `unverified` — goes to admins for verification.",
        "requestBody": { "required": true, "content": { "application/json": { "schema": {
          "type": "object", "required": ["itemId"],
          "properties": {
            "itemId": { "type": "string", "format": "uuid" },
            "locationLabel": { "type": "string" },
            "latitude": { "type": "number" }, "longitude": { "type": "number" },
            "sightedAt": { "type": "string", "format": "date-time" },
            "description": { "type": "string" },
            "reporterPhone": { "type": "string" }
          }
        } } } },
        "responses": { "201": { "description": "Created" }, "401": { "$ref": "#/components/responses/Unauthorized" } }
      }
    },
    "/api/missing-persons": {
      "get": {
        "tags": ["Missing Persons"], "summary": "Search missing person reports", "security": [],
        "parameters": [
          { "name": "status", "in": "query", "schema": { "type": "string" } },
          { "name": "query", "in": "query", "schema": { "type": "string" } },
          { "name": "city", "in": "query", "schema": { "type": "string" } },
          { "name": "is_child", "in": "query", "schema": { "type": "boolean" } },
          { "name": "page", "in": "query", "schema": { "type": "integer" } },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "maximum": 50 } }
        ],
        "responses": { "200": { "description": "OK" } }
      },
      "post": {
        "tags": ["Missing Persons"], "summary": "Report a missing person", "security": [{ "bearerAuth": [] }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": {
          "type": "object", "required": ["fullName", "description", "dateOccurred"],
          "properties": {
            "fullName": { "type": "string" }, "age": { "type": "integer" }, "gender": { "type": "string" },
            "heightCm": { "type": "number" }, "weightKg": { "type": "number" },
            "eyeColor": { "type": "string" }, "hairColor": { "type": "string" }, "skinTone": { "type": "string" },
            "clothingLastSeen": { "type": "string" }, "distinguishingFeatures": { "type": "string" },
            "medicalConditions": { "type": "string" }, "isChild": { "type": "boolean" },
            "description": { "type": "string" }, "dateOccurred": { "type": "string", "format": "date" },
            "lastSeenAt": { "type": "string", "format": "date-time" },
            "locationLabel": { "type": "string" }, "latitude": { "type": "number" }, "longitude": { "type": "number" },
            "contactPhone": { "type": "string" }, "contactEmail": { "type": "string" }
          }
        } } } },
        "responses": { "201": { "description": "Created" }, "401": { "$ref": "#/components/responses/Unauthorized" } }
      }
    },
    "/api/missing-persons/{id}": {
      "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
      "get": { "tags": ["Missing Persons"], "summary": "Missing person detail with images", "security": [], "responses": { "200": { "description": "OK" }, "404": { "$ref": "#/components/responses/NotFound" } } }
    },
    "/api/claims": {
      "get": { "tags": ["Claims"], "summary": "Current user's claims", "security": [{ "bearerAuth": [] }], "parameters": [{ "name": "status", "in": "query", "schema": { "type": "string" } }, { "name": "page", "in": "query", "schema": { "type": "integer" } }], "responses": { "200": { "description": "OK" } } },
      "post": {
        "tags": ["Claims"], "summary": "Submit a claim on a found item", "security": [{ "bearerAuth": [] }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["itemId", "description"], "properties": { "itemId": { "type": "string", "format": "uuid" }, "description": { "type": "string" } } } } } },
        "responses": { "201": { "description": "Created" }, "409": { "description": "Already claimed" } }
      }
    },
    "/api/claims/{id}": {
      "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
      "get": { "tags": ["Claims"], "summary": "Claim detail with proofs", "security": [{ "bearerAuth": [] }], "responses": { "200": { "description": "OK" } } },
      "patch": { "tags": ["Claims"], "summary": "Update claim status", "security": [{ "bearerAuth": [] }], "responses": { "200": { "description": "Updated" } } },
      "delete": { "tags": ["Claims"], "summary": "Withdraw claim", "security": [{ "bearerAuth": [] }], "responses": { "200": { "description": "Deleted" } } }
    },
    "/api/claims/{id}/proofs": {
      "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
      "post": { "tags": ["Claims"], "summary": "Upload proof of ownership", "security": [{ "bearerAuth": [] }], "requestBody": { "content": { "multipart/form-data": { "schema": { "type": "object", "properties": { "file": { "type": "string", "format": "binary" } } } } } }, "responses": { "201": { "description": "Uploaded" } } }
    },
    "/api/disputes": {
      "get": { "tags": ["Disputes"], "summary": "Current user's disputes", "security": [{ "bearerAuth": [] }], "responses": { "200": { "description": "OK" } } },
      "post": {
        "tags": ["Disputes"], "summary": "Raise a dispute on a claim decision", "security": [{ "bearerAuth": [] }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["claimId", "reason"], "properties": { "claimId": { "type": "string", "format": "uuid" }, "reason": { "type": "string" } } } } } },
        "responses": { "201": { "description": "Created" } }
      }
    },
    "/api/ratings": {
      "post": {
        "tags": ["Ratings"], "summary": "Rate the other party after a return", "security": [{ "bearerAuth": [] }],
        "description": "Only the owner and finder of an item can rate each other.",
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Rating" } } } },
        "responses": { "201": { "description": "Created" }, "403": { "$ref": "#/components/responses/Forbidden" } }
      }
    },
    "/api/users/{id}/ratings": {
      "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
      "get": { "tags": ["Ratings"], "summary": "A user's ratings + average score", "security": [], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/Envelope" }], "properties": { "summary": { "type": "object", "properties": { "averageScore": { "type": "number", "nullable": true }, "totalRatings": { "type": "integer" } } } } } } } } } }
    },
    "/api/identity-verification": {
      "get": { "tags": ["Identity Verification"], "summary": "Get my KYC status", "security": [{ "bearerAuth": [] }], "responses": { "200": { "description": "Status + rejection reason if rejected" } } },
      "post": {
        "tags": ["Identity Verification"], "summary": "Submit KYC documents", "security": [{ "bearerAuth": [] }],
        "requestBody": { "required": true, "content": { "multipart/form-data": { "schema": {
          "type": "object",
          "required": ["idType", "fullName", "idNumber", "document"],
          "properties": {
            "idType": { "type": "string", "enum": ["national_id", "passport", "drivers_license"] },
            "fullName": { "type": "string" },
            "idNumber": { "type": "string" },
            "dateOfBirth": { "type": "string", "format": "date" },
            "document": { "type": "string", "format": "binary" },
            "selfie": { "type": "string", "format": "binary" }
          }
        } } } },
        "responses": { "201": { "description": "Submitted — pending admin review" }, "409": { "description": "Already pending/approved" } }
      }
    },
    "/api/payments/initialize": {
      "post": {
        "tags": ["Payments"], "summary": "Fund an item's reward (owner only)", "security": [{ "bearerAuth": [] }],
        "description": "Creates a Paystack transaction. Redirect the payer to `data.checkoutUrl`. On success Paystack hits our webhook and the escrow moves to `funded` (held).",
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["itemId", "email"], "properties": { "itemId": { "type": "string", "format": "uuid" }, "email": { "type": "string", "format": "email" } } } } } },
        "responses": { "201": { "description": "Initialized", "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/Envelope" }], "properties": { "data": { "$ref": "#/components/schemas/Payment" } } } } } }, "403": { "$ref": "#/components/responses/Forbidden" }, "409": { "description": "Payment already in progress" } }
      }
    },
    "/api/payments/webhook": {
      "post": { "tags": ["Payments"], "summary": "Paystack webhook (server-to-server)", "security": [], "description": "HMAC-SHA512 signature verified via `x-paystack-signature`. Do not call from clients.", "responses": { "200": { "description": "Processed" }, "401": { "description": "Invalid signature" } } }
    },
    "/api/reports": {
      "post": {
        "tags": ["Reports"], "summary": "File a report (abuse/fraud/safety)", "security": [{ "bearerAuth": [] }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": {
          "type": "object", "required": ["targetType", "targetId", "reason"],
          "properties": {
            "targetType": { "type": "string", "enum": ["item", "user", "claim", "sighting"] },
            "targetId": { "type": "string" },
            "reason": { "type": "string", "enum": ["csae", "abuse", "harassment", "spam", "fake", "other"] },
            "description": { "type": "string" }
          }
        } } } },
        "responses": { "201": { "description": "Filed — enters admin queue" }, "401": { "$ref": "#/components/responses/Unauthorized" } }
      }
    },
    "/api/notifications": {
      "get": { "tags": ["Notifications"], "summary": "My notifications", "security": [{ "bearerAuth": [] }], "parameters": [{ "name": "unread_only", "in": "query", "schema": { "type": "boolean" } }, { "name": "limit", "in": "query", "schema": { "type": "integer", "maximum": 50 } }], "responses": { "200": { "description": "OK" } } }
    },
    "/api/notifications/unread-count": {
      "get": { "tags": ["Notifications"], "summary": "Unread badge count", "security": [{ "bearerAuth": [] }], "responses": { "200": { "description": "OK" } } }
    },
    "/api/notifications/{id}": {
      "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
      "patch": { "tags": ["Notifications"], "summary": "Mark notification read", "security": [{ "bearerAuth": [] }], "responses": { "200": { "description": "OK" } } }
    },
    "/api/notifications/read-all": {
      "patch": { "tags": ["Notifications"], "summary": "Mark all notifications read", "security": [{ "bearerAuth": [] }], "responses": { "200": { "description": "OK" } } }
    },
    "/api/push-tokens": {
      "post": { "tags": ["Notifications"], "summary": "Register FCM push token", "security": [{ "bearerAuth": [] }], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["token"], "properties": { "token": { "type": "string" }, "platform": { "type": "string", "enum": ["android", "ios", "web"] } } } } } }, "responses": { "201": { "description": "Registered" } } },
      "delete": { "tags": ["Notifications"], "summary": "Unregister push token", "security": [{ "bearerAuth": [] }], "parameters": [{ "name": "token", "in": "query", "required": true, "schema": { "type": "string" } }], "responses": { "200": { "description": "Removed" } } }
    },
    "/api/location-subscriptions": {
      "get": { "tags": ["Locations"], "summary": "My proximity alert subscriptions", "security": [{ "bearerAuth": [] }], "responses": { "200": { "description": "OK" } } },
      "post": { "tags": ["Locations"], "summary": "Subscribe to alerts near a point", "security": [{ "bearerAuth": [] }], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["latitude", "longitude", "radiusKm"], "properties": { "latitude": { "type": "number" }, "longitude": { "type": "number" }, "radiusKm": { "type": "number" }, "label": { "type": "string" } } } } } }, "responses": { "201": { "description": "Created" } } },
      "delete": { "tags": ["Locations"], "summary": "Remove subscription", "security": [{ "bearerAuth": [] }], "parameters": [{ "name": "id", "in": "query", "required": true, "schema": { "type": "string", "format": "uuid" } }], "responses": { "200": { "description": "Removed" } } }
    },
    "/api/users/{id}/deletion-request": {
      "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "format": "uuid" } }],
      "post": { "tags": ["Users"], "summary": "Request account deletion (GDPR)", "security": [{ "bearerAuth": [] }], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "reason": { "type": "string" } } } } } }, "responses": { "201": { "description": "Requested — pending admin approval" }, "403": { "$ref": "#/components/responses/Forbidden" } } }
    },
    "/api/contact": {
      "post": { "tags": ["Misc"], "summary": "Contact form", "security": [], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["name", "email", "subject", "message"], "properties": { "name": { "type": "string" }, "email": { "type": "string" }, "subject": { "type": "string" }, "message": { "type": "string" } } } } } }, "responses": { "201": { "description": "Sent" } } }
    },
    "/api/cron/expire-items": {
      "post": { "tags": ["Misc"], "summary": "Expire stale listings (scheduled job)", "security": [{ "bearerAuth": [] }], "description": "Requires `Authorization: Bearer <CRON_SECRET>`. Marks active items past `expires_at` as expired and notifies owners.", "responses": { "200": { "description": "Job result" }, "401": { "$ref": "#/components/responses/Unauthorized" } } }
    }
  }
}
