{
  "openapi": "3.1.0",
  "info": {
    "title": "PhoneVyapar Public API",
    "version": "1.0.0",
    "description": "Public capabilities and discovery endpoints for PhoneVyapar — India's leading second-hand mobile shop management and IMEI registry platform.",
    "contact": {
      "name": "PhoneVyapar Support",
      "email": "phonevyapar@gmail.com",
      "url": "https://www.phonevyapar.live/contact"
    }
  },
  "servers": [
    {
      "url": "https://phonevyapar-backend.magnytesolution.com/api",
      "description": "Production API Server"
    },
    {
      "url": "https://www.phonevyapar.live/api",
      "description": "Primary Domain Proxy"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "summary": "Health and service status",
        "description": "Returns operational status and connectivity info of the PhoneVyapar platform.",
        "responses": {
          "200": {
            "description": "Service is healthy and online",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": { "type": "string", "example": "ok" },
                    "time": { "type": "string", "format": "date-time" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/app/version-check": {
      "get": {
        "summary": "Application version verification",
        "description": "Checks minimum and latest supported app version for Android and iOS clients.",
        "parameters": [
          { "name": "platform", "in": "query", "schema": { "type": "string", "default": "android" } },
          { "name": "version", "in": "query", "schema": { "type": "string", "default": "1.0.6" } },
          { "name": "versionCode", "in": "query", "schema": { "type": "integer", "default": 10 } }
        ],
        "responses": {
          "200": {
            "description": "Version details and update status"
          }
        }
      }
    },
    "/referrals/validate/{code}": {
      "get": {
        "summary": "Validate referral code",
        "description": "Validates a retailer partner referral code and returns the shop invite profile.",
        "parameters": [
          { "name": "code", "in": "path", "required": true, "schema": { "type": "string" } }
        ],
        "responses": {
          "200": {
            "description": "Referral code is valid",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "valid": { "type": "boolean" },
                    "shopName": { "type": "string" }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Referral code not found or invalid"
          }
        }
      }
    }
  }
}

