{
  "openapi": "3.0.0",
  "info": {
    "title": "VSnip API",
    "version": "1.0.0",
    "description": "API for VSnip application"
  },
  "servers": [
    {
      "url": "http://localhost:3001",
      "description": "Local development server"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          }
        }
      },
      "Health": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "example": "UP"
          },
          "message": {
            "type": "string",
            "example": "API is healthy"
          }
        }
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "summary": "Health Check",
        "description": "Checks the health of the API.",
        "tags": [
          "General"
        ],
        "responses": {
          "200": {
            "description": "API is healthy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/google": {
      "get": {
        "summary": "Google Login",
        "description": "Initiates Google OAuth2 login flow. Redirects to Google.",
        "tags": [
          "Auth"
        ],
        "responses": {
          "302": {
            "description": "Redirect to Google for authentication."
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/google/callback": {
      "get": {
        "summary": "Google Login Callback",
        "description": "Handles the callback from Google OAuth2.",
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "required": true,
            "description": "Authorization code from Google.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully authenticated. Returns tokens.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Define response schema for tokens"
                }
              }
            }
          },
          "302": {
            "description": "Redirect on failure (e.g., to /login-error)."
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/me": {
      "get": {
        "summary": "Get Current User",
        "description": "Retrieves the currently authenticated user's information.",
        "tags": [
          "Auth"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Current user data.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Define response schema for user data"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/users/feed": {
      "get": {
        "summary": "Get User Feed",
        "description": "Retrieves the feed for the authenticated user.",
        "tags": [
          "Users"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "User feed data.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Define response schema for feed"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/users/current": {
      "put": {
        "summary": "Update Current User",
        "description": "Updates the authenticated user's information.",
        "tags": [
          "Users"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "description": "Define schema for user update payload",
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "example": "Jane Doe"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "User updated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Define response schema for updated user"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request (e.g., validation error)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/users/{id}": {
      "get": {
        "summary": "Get User by ID",
        "description": "Retrieves a specific user by their ID.",
        "tags": [
          "Users"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "ID of the user to retrieve.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "User data.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Define response schema for user"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "User not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/users/dev": {
      "post": {
        "summary": "Create User (Development)",
        "description": "Creates a new user (for development purposes only). This endpoint might not be available in production.",
        "tags": [
          "Users",
          "Development"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "description": "Define schema for new user payload",
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "example": "dev@example.com"
                  },
                  "name": {
                    "type": "string",
                    "example": "Dev User"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "User created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Define response schema for created user"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/conversations": {
      "get": {
        "summary": "Get Conversations",
        "description": "Retrieves a list of conversations for the authenticated user, optionally with a cursor for pagination.",
        "tags": [
          "Conversations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Cursor for pagination. Note: Original YAML had 'in: path', adjusted to 'in: query' for optionality.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of conversations.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Define response schema for conversation list"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create Conversation",
        "description": "Creates a new conversation.",
        "tags": [
          "Conversations"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "description": "Define schema for new conversation payload",
                "type": "object",
                "properties": {
                  "participantIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "example": [
                      "userId1",
                      "userId2"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Conversation created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Define response schema for created conversation"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/messages/{userId}": {
      "get": {
        "summary": "Get Messages with a User",
        "description": "Retrieves messages exchanged with a specific user, optionally with a cursor for pagination.",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "description": "ID of the other user in the conversation.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Cursor for pagination. Note: Original YAML had 'in: path' for /messages/{userId}/{cursor?}, adjusted to 'in: query' as it's typically an optional parameter appended to the base path /messages/{userId}.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of messages.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Define response schema for message list"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "User or conversation not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/messages": {
      "post": {
        "summary": "Create Message",
        "description": "Sends a new message.",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "description": "Define schema for new message payload",
                "type": "object",
                "properties": {
                  "receiverId": {
                    "type": "string",
                    "example": "userId2"
                  },
                  "content": {
                    "type": "string",
                    "example": "Hello there!"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Message created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "description": "Define response schema for created message"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  }
}