{
  "swagger": "2.0",
  "info": {
    "version": "1.0.0",
    "title": "REST API",
    "description": "",
    "termsOfService": "https://furkandogu.vercel.app",
    "contact": {
      "name": "Furkan",
      "email": "furkandogu2018@gmail.com"
    },
    "license": {
      "name": "ISC"
    }
  },
  "host": "https://task-manager-api-virid.vercel.app",
  "basePath": "/",
  "schemes": [
    "https"
  ],
  "securityDefinitions": {
    "bearerAuth": {
      "type": "http",
      "scheme": "bearer",
      "bearerFormat": "JWT",
      "description": "JWT Authorization header using the Bearer scheme. Example: <b>Bearer yourTokenHere</b>"
    }
  },
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/api/auth/register": {
      "post": {
        "tags": [
          "Authentication"
        ],
        "summary": "Register",
        "description": "Register user with multipart/form-data (includes image)",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "example": "Test"
                },
                "email": {
                  "type": "string",
                  "example": "test@site.com"
                },
                "password": {
                  "type": "string",
                  "example": "test@123"
                },
                "profileImageUrl": {
                  "type": "string",
                  "example": "https://www.image.com/image.jpg"
                },
                "adminInviteToken": {
                  "type": "string",
                  "example": "******"
                }
              }
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Created"
          },
          "400": {
            "description": "Bad Request"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    },
    "/api/auth/login": {
      "post": {
        "tags": [
          "Authentication"
        ],
        "summary": "Login",
        "description": "Login with email and password",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "properties": {
                "email": {
                  "type": "string",
                  "example": "test@site.com"
                },
                "password": {
                  "type": "string",
                  "example": "test@123"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    },
    "/api/auth/logout": {
      "get": {
        "tags": [
          "Authentication"
        ],
        "summary": "Logout",
        "description": "",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/auth/profile": {
      "get": {
        "tags": [
          "Authentication"
        ],
        "summary": "Get User Profile",
        "description": "",
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      },
      "put": {
        "tags": [
          "Authentication"
        ],
        "summary": "Update User Profile",
        "description": "",
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "example": "Test"
                },
                "email": {
                  "type": "string",
                  "example": "test@site.com"
                },
                "password": {
                  "type": "string",
                  "example": "test@123"
                },
                "profileImageUrl": {
                  "type": "string",
                  "example": "https://www.image.com/image.jpg"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    },
    "/api/users/": {
      "get": {
        "tags": [
          "Users"
        ],
        "summary": "Get All Members with Task Counts",
        "description": "Returns a list of all users with role 'member' along with their task statistics (pending, in-progress, completed).",
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    },
    "/api/users/{id}": {
      "get": {
        "tags": [
          "Users"
        ],
        "summary": "Get User by ID",
        "description": "Returns user details by user ID, excluding password field.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "authorization",
            "in": "header",
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      },
      "delete": {
        "tags": [
          "Users"
        ],
        "summary": "Delete User",
        "description": "Deletes a user by ID. Typically used by admin.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "authorization",
            "in": "header",
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      },
      "put": {
        "tags": [
          "Users"
        ],
        "summary": "Update User by Admin",
        "description": "Admin can update any user's profile info by ID (including role, isActive, profile image etc).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "authorization",
            "in": "header",
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "example": "Test"
                },
                "email": {
                  "type": "string",
                  "example": "test@site.com"
                },
                "password": {
                  "type": "string",
                  "example": "test@123"
                },
                "profileImageUrl": {
                  "type": "string",
                  "example": "https://www.image.com/image.jpg"
                },
                "isActive": {
                  "type": "boolean",
                  "example": true
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    },
    "/api/tasks/dashboard-data": {
      "get": {
        "tags": [
          "Tasks"
        ],
        "summary": "Get Admin Dashboard Data",
        "description": "",
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    },
    "/api/tasks/user-dashboard-data": {
      "get": {
        "tags": [
          "Tasks"
        ],
        "summary": "Get User Dashboard Data",
        "description": "",
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    },
    "/api/tasks/": {
      "get": {
        "tags": [
          "Tasks"
        ],
        "summary": "Get All Tasks",
        "description": "Returns a list of all tasks. Admins get all tasks; members get only their own.",
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "type": "string"
          },
          {
            "name": "status",
            "in": "query",
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      },
      "post": {
        "tags": [
          "Tasks"
        ],
        "summary": "Create a New Task",
        "description": "",
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "type": "string"
          }
        ],
        "responses": {
          "201": {
            "description": "Created"
          },
          "400": {
            "description": "Bad Request"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    },
    "/api/tasks/{id}": {
      "get": {
        "tags": [
          "Tasks"
        ],
        "summary": "Get Task by ID",
        "description": "Returns task detail with assigned user data.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "authorization",
            "in": "header",
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      },
      "put": {
        "tags": [
          "Tasks"
        ],
        "summary": "Update Task",
        "description": "",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "authorization",
            "in": "header",
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "schema": {
              "type": "object",
              "properties": {
                "title": {
                  "example": "any"
                },
                "description": {
                  "example": "any"
                },
                "priority": {
                  "example": "any"
                },
                "dueDate": {
                  "example": "any"
                },
                "todoChecklist": {
                  "example": "any"
                },
                "attachments": {
                  "example": "any"
                },
                "assignedTo": {
                  "example": "any"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Bad Request"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      },
      "delete": {
        "tags": [
          "Tasks"
        ],
        "summary": "Delete Task",
        "description": "Deletes a task by its ID.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "authorization",
            "in": "header",
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    },
    "/api/tasks/{id}/status": {
      "put": {
        "tags": [
          "Tasks"
        ],
        "summary": "Update Task Status",
        "description": "",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "authorization",
            "in": "header",
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "schema": {
              "type": "object",
              "properties": {
                "status": {
                  "example": "any"
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    },
    "/api/tasks/{id}/todo": {
      "put": {
        "tags": [
          "Tasks"
        ],
        "summary": "Update Task Status",
        "description": "",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "authorization",
            "in": "header",
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "properties": {
                "todoChecklist": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string",
                        "example": "text 2"
                      },
                      "completed": {
                        "type": "boolean",
                        "example": true
                      }
                    }
                  }
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    },
    "/api/reports/export/tasks": {
      "get": {
        "tags": [
          "Reports"
        ],
        "summary": "Export Task Report",
        "description": "Exports all tasks to an Excel (.xlsx) file including ID, title, description, priority, status, due date, and assigned users.",
        "produces": [
          "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
        ],
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "type": "string"
          }
        ],
        "responses": {
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    },
    "/api/reports/export/users": {
      "get": {
        "tags": [
          "Reports"
        ],
        "summary": "Export User Task Summary",
        "description": "Generates an Excel report showing each user’s total task count and task distribution by status (Pending, In Progress, Completed).",
        "produces": [
          "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
        ],
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "type": "string"
          }
        ],
        "responses": {
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ]
}