{
  "openapi": "3.0.3",
  "info": {
    "title": "DeployBase API",
    "description": "DeployBase is a modern web hosting platform that provides managed hosting for PHP, Node.js, WordPress, and Laravel applications. This API allows you to manage hosting accounts, domains, databases, deployments, and more.\n\n## Authentication\n\nGenerate an API token from **Dashboard > Settings > Security**. Include it in every request:\n\n```\nAuthorization: Bearer dk_your_api_token\n```\n\nAPI tokens (prefixed with `dk_`) can be regenerated or revoked from the dashboard at any time.",
    "version": "1.0.0",
    "contact": {
      "name": "DeployBase Support",
      "url": "https://deploybase.io"
    }
  },
  "servers": [
    {
      "url": "https://deploybase.io",
      "description": "Production API"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "tags": [
    { "name": "Authentication", "description": "Register, login, logout, profile management, and API token generation" },
    { "name": "Accounts", "description": "Hosting account CRUD, plan changes, and settings" },
    { "name": "Domains", "description": "Add, verify, update, and delete domains" },
    { "name": "SSL", "description": "SSL certificate management" },
    { "name": "PHP", "description": "PHP version and settings management" },
    { "name": "Databases", "description": "Database listing and creation" },
    { "name": "SSH", "description": "SSH access management and key management" },
    { "name": "Backups", "description": "Backup CRUD and schedule management" },
    { "name": "Git Deploy", "description": "Git repository configuration, branches, deployments, and webhooks" },
    { "name": "Monitoring", "description": "Traffic, disk, resource, and service monitoring" },
    { "name": "Cron Jobs", "description": "Cron job management" },
    { "name": "Node.js", "description": "Node.js service restart and log viewing" },
    { "name": "Installers", "description": "WordPress, Laravel, and static site installers" },
    { "name": "File Manager", "description": "SFTP and file manager credentials" },
    { "name": "Web Rules", "description": "Nginx redirect, rewrite, and IP block rules" },
    { "name": "Staging", "description": "Staging environment management" },
    { "name": "Security", "description": "IP blocklist, security headers, and malware scanning" },
    { "name": "Cloudflare", "description": "Cloudflare CDN integration, DNS, cache, and analytics" }
  ],
  "paths": {
    "/api/auth/register": {
      "post": {
        "tags": ["Authentication"],
        "summary": "Register a new account",
        "operationId": "register",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["email", "password", "name"],
                "properties": {
                  "email": { "type": "string", "format": "email", "example": "user@example.com" },
                  "password": { "type": "string", "format": "password", "minLength": 8, "example": "securePassword123" },
                  "name": { "type": "string", "example": "John Doe" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Registration successful",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user": { "$ref": "#/components/schemas/User" }
                  }
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" }
        }
      }
    },
    "/api/auth/login": {
      "post": {
        "tags": ["Authentication"],
        "summary": "Log in to an existing account",
        "operationId": "login",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["email", "password"],
                "properties": {
                  "email": { "type": "string", "format": "email", "example": "user@example.com" },
                  "password": { "type": "string", "format": "password", "example": "securePassword123" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Login successful",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user": { "$ref": "#/components/schemas/User" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/api/auth/logout": {
      "post": {
        "tags": ["Authentication"],
        "summary": "Log out and clear session cookies",
        "operationId": "logout",
        "responses": {
          "200": { "$ref": "#/components/responses/Success" }
        }
      }
    },
    "/api/auth/me": {
      "get": {
        "tags": ["Authentication"],
        "summary": "Get current authenticated user",
        "operationId": "getCurrentUser",
        "responses": {
          "200": {
            "description": "Current user profile",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/User" }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/api/auth/change-password": {
      "post": {
        "tags": ["Authentication"],
        "summary": "Change the current user's password",
        "operationId": "changePassword",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["currentPassword", "newPassword"],
                "properties": {
                  "currentPassword": { "type": "string", "format": "password" },
                  "newPassword": { "type": "string", "format": "password", "minLength": 8 }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/api/auth/forgot-password": {
      "post": {
        "tags": ["Authentication"],
        "summary": "Request a password reset email",
        "operationId": "forgotPassword",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["email"],
                "properties": {
                  "email": { "type": "string", "format": "email", "example": "user@example.com" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Success" }
        }
      }
    },
    "/api/auth/reset-password": {
      "post": {
        "tags": ["Authentication"],
        "summary": "Reset password using a token from the reset email",
        "operationId": "resetPassword",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["token", "password"],
                "properties": {
                  "token": { "type": "string" },
                  "password": { "type": "string", "format": "password", "minLength": 8 }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" }
        }
      }
    },
    "/api/auth/verify-email": {
      "post": {
        "tags": ["Authentication"],
        "summary": "Verify email address using a verification token",
        "operationId": "verifyEmail",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["token"],
                "properties": {
                  "token": { "type": "string" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" }
        }
      }
    },
    "/api/auth/resend-verification": {
      "post": {
        "tags": ["Authentication"],
        "summary": "Resend the email verification link",
        "operationId": "resendVerification",
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/api/auth/api-token": {
      "get": {
        "tags": ["Authentication"],
        "summary": "Check if an API token exists",
        "operationId": "getApiToken",
        "responses": {
          "200": {
            "description": "Token status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "hasToken": { "type": "boolean" },
                    "createdAt": { "type": "string", "format": "date-time", "nullable": true }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      },
      "post": {
        "tags": ["Authentication"],
        "summary": "Generate or regenerate an API token",
        "operationId": "generateApiToken",
        "description": "Generates a new dk_-prefixed API token. If a token already exists, it is replaced. The plaintext token is returned only once.",
        "responses": {
          "200": {
            "description": "Token generated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "token": { "type": "string", "example": "dk_a1b2c3d4e5f6..." },
                    "message": { "type": "string" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      },
      "delete": {
        "tags": ["Authentication"],
        "summary": "Revoke the API token",
        "operationId": "revokeApiToken",
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/api/hosting/products": {
      "get": {
        "tags": ["Accounts"],
        "summary": "List all hosting products and their plans",
        "operationId": "listProducts",
        "security": [],
        "responses": {
          "200": {
            "description": "List of hosting products",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "products": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/Product" }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/hosting/products/{slug}": {
      "get": {
        "tags": ["Accounts"],
        "summary": "Get a specific hosting product by slug",
        "operationId": "getProduct",
        "security": [],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": { "type": "string" },
            "example": "web-hosting"
          }
        ],
        "responses": {
          "200": {
            "description": "Hosting product details",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Product" }
              }
            }
          },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/webhooks/git/{appId}": {
      "post": {
        "tags": ["Git Deploy"],
        "summary": "Git webhook endpoint for auto-deploy",
        "description": "Receives push events from GitHub, GitLab, or Bitbucket to trigger automatic deployments. Validates the request using the X-Hub-Signature-256 header.",
        "operationId": "gitWebhook",
        "security": [],
        "parameters": [
          {
            "name": "appId",
            "in": "path",
            "required": true,
            "schema": { "type": "integer" },
            "example": 42
          },
          {
            "name": "X-Hub-Signature-256",
            "in": "header",
            "required": true,
            "schema": { "type": "string" },
            "description": "HMAC SHA-256 signature of the request body"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "Git provider webhook payload"
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/api/hosting/accounts": {
      "get": {
        "tags": ["Accounts"],
        "summary": "List all hosting accounts for the authenticated user",
        "operationId": "listAccounts",
        "responses": {
          "200": {
            "description": "List of hosting accounts",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "accounts": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/HostingAccount" }
                    }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      },
      "post": {
        "tags": ["Accounts"],
        "summary": "Create a new hosting account",
        "operationId": "createAccount",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["planId", "label"],
                "properties": {
                  "planId": { "type": "integer", "example": 1 },
                  "label": { "type": "string", "example": "My Website" },
                  "domain": { "type": "string", "example": "example.com" },
                  "siteType": {
                    "type": "string",
                    "enum": ["PHP", "NODEJS", "WORDPRESS", "LARAVEL"],
                    "example": "WORDPRESS"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Account created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "account": { "$ref": "#/components/schemas/HostingAccount" },
                    "credentials": {
                      "type": "object",
                      "properties": {
                        "username": { "type": "string", "example": "user_abc123" },
                        "domain": { "type": "string", "example": "mysite.deploybase.io" },
                        "filesDomain": { "type": "string", "example": "files-mysite.deploybase.io" },
                        "siteType": { "type": "string", "example": "WORDPRESS" }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}": {
      "get": {
        "tags": ["Accounts"],
        "summary": "Get a specific hosting account with container status",
        "operationId": "getAccount",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": {
            "description": "Hosting account details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "account": { "$ref": "#/components/schemas/HostingAccount" },
                    "containerStatus": { "$ref": "#/components/schemas/ContainerStatus" },
                    "fileManager": { "$ref": "#/components/schemas/FileManagerInfo" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      },
      "delete": {
        "tags": ["Accounts"],
        "summary": "Terminate a hosting account",
        "description": "Permanently deletes the hosting account and all associated data including containers, domains, databases, and files.",
        "operationId": "deleteAccount",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/available-plans": {
      "get": {
        "tags": ["Accounts"],
        "summary": "List the current plan and the other plans (changing plan is not self-serve; contact us)",
        "operationId": "getAvailablePlans",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": {
            "description": "Available plans",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "currentPlan": { "$ref": "#/components/schemas/Plan" },
                    "availablePlans": {
                      "type": "array",
                      "items": {
                        "allOf": [
                          { "$ref": "#/components/schemas/Plan" },
                          {
                            "type": "object",
                            "properties": {
                              "isCurrent": { "type": "boolean" },
                              "isUpgrade": { "type": "boolean" },
                              "priceDifference": { "type": "number", "format": "float" }
                            }
                          }
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/settings": {
      "patch": {
        "tags": ["Accounts"],
        "summary": "Update account settings",
        "operationId": "updateAccountSettings",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": { "type": "string", "example": "My Production Site" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/stats": {
      "get": {
        "tags": ["Accounts"],
        "summary": "Get account storage and bandwidth usage statistics",
        "operationId": "getAccountStats",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": {
            "description": "Account usage statistics",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "storage": { "$ref": "#/components/schemas/UsageStat" },
                    "bandwidth": { "$ref": "#/components/schemas/UsageStat" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/restart": {
      "post": {
        "tags": ["Accounts"],
        "summary": "Restart all containers for an account",
        "operationId": "restartAccount",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/stop": {
      "post": {
        "tags": ["Accounts"],
        "summary": "Stop a site and mark it as suspended",
        "operationId": "stopAccount",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/start": {
      "post": {
        "tags": ["Accounts"],
        "summary": "Start a stopped site and mark it as active",
        "operationId": "startAccount",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/logs": {
      "get": {
        "tags": ["Monitoring"],
        "summary": "Get general Docker Compose logs for an account",
        "operationId": "getAccountLogs",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          {
            "name": "lines",
            "in": "query",
            "schema": { "type": "integer", "default": 100 },
            "description": "Number of log lines to return"
          }
        ],
        "responses": {
          "200": {
            "description": "Log output",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean", "example": true },
                    "logs": { "type": "string" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/logs/{logType}": {
      "get": {
        "tags": ["Monitoring"],
        "summary": "Get specific log type for an account",
        "operationId": "getAccountLogsByType",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          {
            "name": "logType",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": ["apache-access", "apache-error", "php-error", "application"]
            },
            "description": "Type of log to retrieve"
          },
          {
            "name": "lines",
            "in": "query",
            "schema": { "type": "integer", "default": 100 },
            "description": "Number of log lines to return"
          }
        ],
        "responses": {
          "200": {
            "description": "Log output",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean", "example": true },
                    "logs": { "type": "string" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/php-version": {
      "get": {
        "tags": ["PHP"],
        "summary": "Get current PHP version and available versions",
        "operationId": "getPhpVersion",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": {
            "description": "PHP version information",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "currentVersion": { "type": "string", "example": "8.2" },
                    "availableVersions": {
                      "type": "array",
                      "items": { "type": "string" },
                      "example": ["7.4", "8.0", "8.1", "8.2", "8.3"]
                    }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      },
      "post": {
        "tags": ["PHP"],
        "summary": "Change the PHP version for an account",
        "operationId": "setPhpVersion",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["version"],
                "properties": {
                  "version": { "type": "string", "example": "8.3", "enum": ["7.4", "8.0", "8.1", "8.2", "8.3"] }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains": {
      "post": {
        "tags": ["Domains"],
        "summary": "Add a new domain to a hosting account",
        "operationId": "addDomain",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["domain"],
                "properties": {
                  "domain": { "type": "string", "example": "example.com" },
                  "documentRoot": { "type": "string", "example": "/public" },
                  "domainType": {
                    "type": "string",
                    "enum": ["PHP", "NODEJS", "WORDPRESS", "LARAVEL"],
                    "example": "PHP"
                  },
                  "nodeVersion": { "type": "string", "example": "20" }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Domain added",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domain": { "$ref": "#/components/schemas/Domain" },
                    "activated": { "type": "boolean", "example": false },
                    "testUrl": { "type": "string", "example": "https://example-com.deploybase.io" },
                    "dnsInstructions": { "type": "string", "example": "Point your domain's A record to 65.21.225.252" }
                  }
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/verify": {
      "post": {
        "tags": ["Domains"],
        "summary": "Verify domain DNS and activate it",
        "operationId": "verifyDomain",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": {
            "description": "Domain verified and activated",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domain": { "$ref": "#/components/schemas/Domain" }
                  }
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}": {
      "patch": {
        "tags": ["Domains"],
        "summary": "Update domain settings",
        "operationId": "updateDomain",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "documentRoot": { "type": "string", "example": "/public" },
                  "domainType": {
                    "type": "string",
                    "enum": ["PHP", "NODEJS", "WORDPRESS", "LARAVEL"]
                  },
                  "nodeVersion": { "type": "string", "example": "20" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      },
      "delete": {
        "tags": ["Domains"],
        "summary": "Remove a domain from an account",
        "description": "Deletes a domain from the hosting account. The primary domain cannot be removed.",
        "operationId": "deleteDomain",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/ssl": {
      "post": {
        "tags": ["SSL"],
        "summary": "Request an SSL certificate for a domain",
        "operationId": "requestSsl",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/domains": {
      "get": {
        "tags": ["Domains"],
        "summary": "List all domains across all accounts for the current user",
        "operationId": "listAllDomains",
        "responses": {
          "200": {
            "description": "List of all user domains",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domains": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/Domain" }
                    }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/php-settings": {
      "get": {
        "tags": ["PHP"],
        "summary": "Get PHP settings for a specific domain",
        "operationId": "getPhpSettings",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": {
            "description": "PHP settings",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "settings": { "$ref": "#/components/schemas/PhpSettings" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      },
      "patch": {
        "tags": ["PHP"],
        "summary": "Update PHP settings for a specific domain",
        "operationId": "updatePhpSettings",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["settings"],
                "properties": {
                  "settings": {
                    "type": "object",
                    "additionalProperties": { "type": "string" },
                    "example": {
                      "memory_limit": "256M",
                      "max_execution_time": "60",
                      "upload_max_filesize": "64M",
                      "post_max_size": "64M"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/monitoring/traffic": {
      "get": {
        "tags": ["Monitoring"],
        "summary": "Get traffic monitoring data for a domain",
        "operationId": "getDomainTraffic",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" },
          {
            "name": "period",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": ["15m", "1h", "6h", "24h", "7d"],
              "default": "24h"
            },
            "description": "Time period for traffic data"
          }
        ],
        "responses": {
          "200": {
            "description": "Traffic monitoring data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "ipRequests": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "ip": { "type": "string" },
                              "count": { "type": "integer" }
                            }
                          }
                        },
                        "botTraffic": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "bot": { "type": "string" },
                              "count": { "type": "integer" }
                            }
                          }
                        },
                        "urlRequests": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "url": { "type": "string" },
                              "count": { "type": "integer" }
                            }
                          }
                        },
                        "statusCodes": {
                          "type": "object",
                          "additionalProperties": { "type": "integer" },
                          "example": { "200": 1500, "301": 45, "404": 12 }
                        },
                        "bandwidth": {
                          "type": "object",
                          "properties": {
                            "totalBytes": { "type": "integer" },
                            "totalMB": { "type": "number", "format": "float" }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/monitoring/disk": {
      "get": {
        "tags": ["Monitoring"],
        "summary": "Get disk usage breakdown for a domain",
        "operationId": "getDomainDisk",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": {
            "description": "Disk usage data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "folders": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "path": { "type": "string", "example": "/wp-content/uploads" },
                              "sizeMB": { "type": "number", "format": "float", "example": 125.5 }
                            }
                          }
                        },
                        "dbTables": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": { "type": "string", "example": "wp_posts" },
                              "sizeMB": { "type": "number", "format": "float", "example": 12.3 }
                            }
                          }
                        },
                        "totalFiles": { "type": "number", "format": "float", "example": 250.8 },
                        "totalDb": { "type": "number", "format": "float", "example": 45.2 }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/crons": {
      "get": {
        "tags": ["Cron Jobs"],
        "summary": "List cron jobs for a domain",
        "operationId": "listCronJobs",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": {
            "description": "List of cron jobs",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "jobs": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/CronJob" }
                    }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      },
      "post": {
        "tags": ["Cron Jobs"],
        "summary": "Add a new cron job",
        "operationId": "addCronJob",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CronJob" }
            }
          }
        },
        "responses": {
          "201": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      },
      "delete": {
        "tags": ["Cron Jobs"],
        "summary": "Delete a cron job",
        "operationId": "deleteCronJob",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CronJob" }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/crontab": {
      "get": {
        "tags": ["Cron Jobs"],
        "summary": "Get the raw crontab content for a domain",
        "operationId": "getCrontab",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": {
            "description": "Raw crontab content",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "content": { "type": "string", "example": "*/5 * * * * /usr/bin/php /app/artisan schedule:run" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      },
      "put": {
        "tags": ["Cron Jobs"],
        "summary": "Replace the entire crontab content for a domain",
        "operationId": "setCrontab",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["content"],
                "properties": {
                  "content": { "type": "string", "example": "*/5 * * * * /usr/bin/php /app/artisan schedule:run\n0 2 * * * /usr/bin/php /app/artisan backup:run" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/restart-node": {
      "post": {
        "tags": ["Node.js"],
        "summary": "Restart the Node.js container for a domain",
        "operationId": "restartNode",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/node-logs": {
      "get": {
        "tags": ["Node.js"],
        "summary": "Get Node.js application logs for a domain",
        "operationId": "getNodeLogs",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": {
            "description": "Node.js application logs",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "logs": { "type": "string" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/ssh": {
      "get": {
        "tags": ["SSH"],
        "summary": "Get SSH access status and credentials",
        "operationId": "getSshStatus",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": {
            "description": "SSH access information",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SshCredentials" }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/ssh/enable": {
      "post": {
        "tags": ["SSH"],
        "summary": "Enable SSH access for an account",
        "operationId": "enableSsh",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": {
            "description": "SSH enabled with credentials",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "credentials": { "$ref": "#/components/schemas/SshCredentials" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/ssh/disable": {
      "post": {
        "tags": ["SSH"],
        "summary": "Disable SSH access for an account",
        "operationId": "disableSsh",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/ssh/reset-password": {
      "post": {
        "tags": ["SSH"],
        "summary": "Reset the SSH password for an account",
        "operationId": "resetSshPassword",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": {
            "description": "New SSH credentials",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "credentials": { "$ref": "#/components/schemas/SshCredentials" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/ssh-keys": {
      "get": {
        "tags": ["SSH"],
        "summary": "List SSH keys for an account",
        "operationId": "listSshKeys",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": {
            "description": "List of SSH keys",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "keys": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/SshKey" }
                    }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      },
      "post": {
        "tags": ["SSH"],
        "summary": "Add an SSH public key",
        "operationId": "addSshKey",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["label", "publicKey"],
                "properties": {
                  "label": { "type": "string", "example": "My MacBook" },
                  "publicKey": { "type": "string", "example": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG..." }
                }
              }
            }
          }
        },
        "responses": {
          "201": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/ssh-keys/{fingerprint}": {
      "delete": {
        "tags": ["SSH"],
        "summary": "Remove an SSH key by fingerprint",
        "operationId": "deleteSshKey",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          {
            "name": "fingerprint",
            "in": "path",
            "required": true,
            "schema": { "type": "string" },
            "example": "SHA256:abcdef123456..."
          }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/databases": {
      "get": {
        "tags": ["Databases"],
        "summary": "List databases for an account",
        "operationId": "listDatabases",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": {
            "description": "List of databases",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "databases": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/Database" }
                    }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      },
      "post": {
        "tags": ["Databases"],
        "summary": "Create a new database",
        "operationId": "createDatabase",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["name"],
                "properties": {
                  "name": { "type": "string", "example": "myapp_production" },
                  "type": {
                    "type": "string",
                    "enum": ["MYSQL", "POSTGRESQL"],
                    "default": "MYSQL",
                    "example": "MYSQL"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/backups": {
      "get": {
        "tags": ["Backups"],
        "summary": "List backups for an account",
        "operationId": "listBackups",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": {
            "description": "List of backups",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "backups": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/Backup" }
                    }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      },
      "post": {
        "tags": ["Backups"],
        "summary": "Create a new backup",
        "operationId": "createBackup",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": { "type": "string", "enum": ["FULL"], "default": "FULL" }
                }
              }
            }
          }
        },
        "responses": {
          "201": { "$ref": "#/components/responses/Success" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/backups/{backupId}": {
      "delete": {
        "tags": ["Backups"],
        "summary": "Delete a specific backup",
        "operationId": "deleteBackup",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/BackupId" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/backups/{backupId}/restore": {
      "post": {
        "tags": ["Backups"],
        "summary": "Restore a backup",
        "operationId": "restoreBackup",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/BackupId" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/backup-schedule": {
      "get": {
        "tags": ["Backups"],
        "summary": "Get the backup schedule configuration",
        "operationId": "getBackupSchedule",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": {
            "description": "Backup schedule configuration",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schedule": { "$ref": "#/components/schemas/BackupSchedule" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      },
      "patch": {
        "tags": ["Backups"],
        "summary": "Update the backup schedule configuration",
        "operationId": "updateBackupSchedule",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": { "type": "boolean" },
                  "frequency": { "type": "string", "enum": ["daily", "2days", "weekly"] },
                  "time": { "type": "integer", "minimum": 0, "maximum": 23, "description": "Hour of day (0-23) in UTC" },
                  "type": { "type": "string", "enum": ["FULL", "FILES", "DATABASE"] },
                  "retention": { "type": "integer", "minimum": 1, "maximum": 5, "description": "Number of backups to retain" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/file-manager": {
      "get": {
        "tags": ["File Manager"],
        "summary": "Get file manager (SFTP) access credentials",
        "operationId": "getFileManager",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": {
            "description": "File manager credentials",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/FileManagerInfo" }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/install/{script}": {
      "post": {
        "tags": ["Installers"],
        "summary": "Run an installation script (Laravel, Node.js, or static)",
        "operationId": "runInstallScript",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          {
            "name": "script",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": ["laravel", "nodejs", "static"]
            },
            "description": "The installation script to run"
          }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/install/wordpress": {
      "post": {
        "tags": ["Installers"],
        "summary": "Install WordPress on an account",
        "operationId": "installWordPress",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["siteTitle", "adminUsername", "adminPassword", "adminEmail"],
                "properties": {
                  "siteTitle": { "type": "string", "example": "My WordPress Site" },
                  "adminUsername": { "type": "string", "example": "admin" },
                  "adminPassword": { "type": "string", "format": "password", "example": "securePass123!" },
                  "adminEmail": { "type": "string", "format": "email", "example": "admin@example.com" },
                  "domainId": { "type": "integer", "description": "Optional domain ID to install WordPress on" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/install/laravel": {
      "post": {
        "tags": ["Installers"],
        "summary": "Install Laravel on an account",
        "operationId": "installLaravel",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "domainId": { "type": "integer", "description": "Optional domain ID to install Laravel on" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/git": {
      "get": {
        "tags": ["Git Deploy"],
        "summary": "Get Git deployment configuration for an account",
        "operationId": "getGitConfig",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": {
            "description": "Git configuration",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "gitRepoUrl": { "type": "string", "nullable": true, "example": "https://github.com/user/repo.git" },
                    "gitBranch": { "type": "string", "nullable": true, "example": "main" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      },
      "patch": {
        "tags": ["Git Deploy"],
        "summary": "Update Git deployment configuration for an account",
        "operationId": "updateGitConfig",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "gitRepoUrl": { "type": "string", "example": "https://github.com/user/repo.git" },
                  "gitBranch": { "type": "string", "example": "main" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/git/branches": {
      "post": {
        "tags": ["Git Deploy"],
        "summary": "Fetch branches from a Git repository",
        "operationId": "getGitBranches",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["repoUrl"],
                "properties": {
                  "repoUrl": { "type": "string", "example": "https://github.com/user/repo.git" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "List of branches",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "branches": {
                      "type": "array",
                      "items": { "type": "string" },
                      "example": ["main", "develop", "feature/auth"]
                    },
                    "defaultBranch": { "type": "string", "example": "main" }
                  }
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/deploy": {
      "post": {
        "tags": ["Git Deploy"],
        "summary": "Trigger a deployment for the account",
        "operationId": "triggerAccountDeploy",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/deployments": {
      "get": {
        "tags": ["Git Deploy"],
        "summary": "List deployments for an account",
        "operationId": "listAccountDeployments",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": {
            "description": "List of deployments",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deployments": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/Deployment" }
                    }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/git/generate-key": {
      "post": {
        "tags": ["Git Deploy"],
        "summary": "Generate an SSH deploy key for a domain's Git integration",
        "operationId": "generateGitDeployKey",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": {
            "description": "Generated deploy key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "publicKey": { "type": "string", "example": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG..." },
                    "fingerprint": { "type": "string", "example": "SHA256:abcdef123456..." }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/git": {
      "patch": {
        "tags": ["Git Deploy"],
        "summary": "Update Git deployment configuration for a domain",
        "operationId": "updateDomainGitConfig",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "gitRepoUrl": { "type": "string", "example": "git@github.com:user/repo.git" },
                  "gitBranch": { "type": "string", "example": "main" },
                  "gitAutoDeploy": { "type": "boolean", "example": true }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/git/test": {
      "post": {
        "tags": ["Git Deploy"],
        "summary": "Test the Git connection and list branches for a domain",
        "operationId": "testDomainGitConnection",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": {
            "description": "Git connection test result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "branches": {
                      "type": "array",
                      "items": { "type": "string" },
                      "example": ["main", "develop"]
                    }
                  }
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/deploy": {
      "post": {
        "tags": ["Git Deploy"],
        "summary": "Trigger a deployment for a specific domain",
        "operationId": "triggerDomainDeploy",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": {
            "description": "Deployment triggered",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deploymentId": { "type": "integer", "example": 42 }
                  }
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/deployments": {
      "get": {
        "tags": ["Git Deploy"],
        "summary": "List deployments for a specific domain",
        "operationId": "listDomainDeployments",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": {
            "description": "List of deployments",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deployments": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/Deployment" }
                    }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/monitoring/resources": {
      "get": {
        "tags": ["Monitoring"],
        "summary": "Get container resource usage for an account",
        "operationId": "getResourceMonitoring",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": {
            "description": "Resource usage data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "containers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": { "type": "string", "example": "web-mysite" },
                          "cpuPercent": { "type": "number", "format": "float", "example": 2.5 },
                          "memoryMB": { "type": "number", "format": "float", "example": 128.4 },
                          "status": { "type": "string", "example": "running" }
                        }
                      }
                    },
                    "totalCpuPercent": { "type": "number", "format": "float", "example": 5.2 },
                    "totalMemoryMB": { "type": "number", "format": "float", "example": 256.8 },
                    "allocatedMemoryMB": { "type": "number", "format": "float", "example": 512.0 },
                    "allocatedCpuPercent": { "type": "number", "format": "float", "example": 100.0 },
                    "cgroup": { "type": "object" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/monitoring/disk": {
      "get": {
        "tags": ["Monitoring"],
        "summary": "Get account-level disk usage breakdown",
        "operationId": "getAccountDiskMonitoring",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": {
            "description": "Disk usage data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "folders": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "path": { "type": "string" },
                          "sizeMB": { "type": "number", "format": "float" }
                        }
                      }
                    },
                    "totalFilesMB": { "type": "number", "format": "float", "example": 350.5 },
                    "backups": {
                      "type": "object",
                      "properties": {
                        "count": { "type": "integer" },
                        "sizeMB": { "type": "number", "format": "float" }
                      }
                    },
                    "allocatedMB": { "type": "number", "format": "float", "example": 5120.0 }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/services": {
      "get": {
        "tags": ["Monitoring"],
        "summary": "List running services and their status for an account",
        "operationId": "listServices",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": {
            "description": "List of services",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "services": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/Service" }
                    }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/services/{service}/restart": {
      "post": {
        "tags": ["Monitoring"],
        "summary": "Restart a specific service",
        "operationId": "restartService",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/ServiceName" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/services/{service}/stop": {
      "post": {
        "tags": ["Monitoring"],
        "summary": "Stop a specific service",
        "operationId": "stopService",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/ServiceName" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/services/{service}/start": {
      "post": {
        "tags": ["Monitoring"],
        "summary": "Start a specific service",
        "operationId": "startService",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/ServiceName" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/monitoring/mysql": {
      "get": {
        "tags": ["Monitoring"],
        "summary": "Get MySQL monitoring data",
        "description": "Returns database connection stats, query metrics, table sizes, and active processes. Only available for WordPress and Laravel domains.",
        "operationId": "getMysqlMonitoring",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": {
            "description": "MySQL monitoring data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": {
                      "type": "object",
                      "properties": {
                        "connections": {
                          "type": "object",
                          "properties": {
                            "active": { "type": "integer", "example": 2 },
                            "max": { "type": "integer", "example": 100 },
                            "total": { "type": "integer", "example": 5 }
                          }
                        },
                        "stats": {
                          "type": "object",
                          "properties": {
                            "queries": { "type": "integer", "example": 15420 },
                            "slowQueries": { "type": "integer", "example": 3 },
                            "uptime": { "type": "integer", "description": "Uptime in seconds", "example": 86400 },
                            "queriesPerSec": { "type": "number", "example": 0.18 }
                          }
                        },
                        "tables": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": { "type": "string", "example": "wp_posts" },
                              "size": { "type": "integer", "description": "Size in bytes", "example": 524288 },
                              "rows": { "type": "integer", "example": 150 }
                            }
                          }
                        },
                        "processes": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": { "type": "integer" },
                              "user": { "type": "string" },
                              "host": { "type": "string" },
                              "db": { "type": "string" },
                              "time": { "type": "integer" },
                              "state": { "type": "string" },
                              "info": { "type": "string" }
                            }
                          }
                        }
                      }
                    },
                    "message": { "type": "string" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/monitoring/php": {
      "get": {
        "tags": ["Monitoring"],
        "summary": "Get PHP-FPM monitoring data",
        "description": "Returns PHP-FPM pool status including active/idle processes, slow requests, and per-process details. Only available for WordPress and Laravel domains.",
        "operationId": "getPhpMonitoring",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": {
            "description": "PHP-FPM monitoring data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": {
                      "type": "object",
                      "properties": {
                        "pool": { "type": "string", "example": "www" },
                        "processManager": { "type": "string", "example": "dynamic" },
                        "startTime": { "type": "string" },
                        "acceptedConnections": { "type": "integer" },
                        "activeProcesses": { "type": "integer", "example": 2 },
                        "idleProcesses": { "type": "integer", "example": 3 },
                        "totalProcesses": { "type": "integer", "example": 5 },
                        "maxActiveProcesses": { "type": "integer", "example": 4 },
                        "slowRequests": { "type": "integer", "example": 0 },
                        "processes": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "pid": { "type": "integer" },
                              "state": { "type": "string" },
                              "startTime": { "type": "integer" },
                              "requests": { "type": "integer" },
                              "duration": { "type": "integer" },
                              "method": { "type": "string" },
                              "uri": { "type": "string" },
                              "memory": { "type": "integer" }
                            }
                          }
                        }
                      }
                    },
                    "message": { "type": "string" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/monitoring/crons": {
      "get": {
        "tags": ["Monitoring"],
        "summary": "Get cron monitoring data",
        "description": "Returns currently running cron processes and recent cron execution history.",
        "operationId": "getCronsMonitoring",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": {
            "description": "Cron monitoring data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": {
                      "type": "object",
                      "properties": {
                        "running": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "pid": { "type": "integer" },
                              "cpu": { "type": "string", "example": "1.2%" },
                              "mem": { "type": "string", "example": "0.5%" },
                              "duration": { "type": "string", "example": "0:05" },
                              "command": { "type": "string" }
                            }
                          }
                        },
                        "history": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "timestamp": { "type": "string" },
                              "command": { "type": "string" },
                              "status": { "type": "string", "example": "completed" }
                            }
                          }
                        }
                      }
                    },
                    "message": { "type": "string" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/web-rules": {
      "get": {
        "tags": ["Web Rules"],
        "summary": "List web rules",
        "description": "Get all nginx redirect, rewrite, and IP block rules for a domain.",
        "operationId": "getWebRules",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": {
            "description": "Web rules list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "rules": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": { "type": "integer" },
                          "type": { "type": "string", "enum": ["redirect", "rewrite", "ip-block", "custom"] },
                          "source": { "type": "string", "example": "^/old-page$" },
                          "destination": { "type": "string", "example": "/new-page" },
                          "statusCode": { "type": "integer", "example": 301 },
                          "raw": { "type": "string" }
                        }
                      }
                    },
                    "message": { "type": "string" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      },
      "post": {
        "tags": ["Web Rules"],
        "summary": "Add a web rule",
        "description": "Add a redirect, rewrite, or IP block rule to nginx for a domain.",
        "operationId": "addWebRule",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["type", "source"],
                "properties": {
                  "type": { "type": "string", "enum": ["redirect", "rewrite", "ip-block"], "example": "redirect" },
                  "source": { "type": "string", "example": "^/old-page$" },
                  "destination": { "type": "string", "example": "/new-page" },
                  "statusCode": { "type": "integer", "enum": [301, 302], "example": 301 }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/web-rules/{ruleIndex}": {
      "delete": {
        "tags": ["Web Rules"],
        "summary": "Remove a web rule",
        "operationId": "removeWebRule",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" },
          {
            "name": "ruleIndex",
            "in": "path",
            "required": true,
            "schema": { "type": "integer" },
            "description": "Index of the rule to remove"
          }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/staging": {
      "get": {
        "tags": ["Staging"],
        "summary": "Get staging status",
        "description": "Check if a staging environment exists and get its details.",
        "operationId": "getStagingStatus",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": {
            "description": "Staging environment status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "staging": {
                      "type": "object",
                      "nullable": true,
                      "properties": {
                        "exists": { "type": "boolean" },
                        "url": { "type": "string", "example": "staging-example-com.mysite.deploybase.io" },
                        "createdAt": { "type": "string", "format": "date-time" },
                        "sizeBytes": { "type": "integer" }
                      }
                    },
                    "message": { "type": "string" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      },
      "post": {
        "tags": ["Staging"],
        "summary": "Create staging environment",
        "description": "Clone production files and database into a staging environment.",
        "operationId": "createStaging",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": {
            "description": "Staging created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "message": { "type": "string" },
                    "url": { "type": "string" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      },
      "delete": {
        "tags": ["Staging"],
        "summary": "Delete staging environment",
        "operationId": "deleteStaging",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/staging/push": {
      "post": {
        "tags": ["Staging"],
        "summary": "Push staging to production",
        "description": "Replace production files with staging. Previous production files are backed up automatically.",
        "operationId": "pushStagingToProduction",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/security": {
      "get": {
        "tags": ["Security"],
        "summary": "Get security status",
        "description": "Returns IP blocklist, security headers configuration, and last malware scan results.",
        "operationId": "getSecurityStatus",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": {
            "description": "Security status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": {
                      "type": "object",
                      "properties": {
                        "blockedIps": {
                          "type": "array",
                          "items": { "type": "string" },
                          "example": ["1.2.3.4", "5.6.7.0/24"]
                        },
                        "headers": {
                          "type": "object",
                          "additionalProperties": { "oneOf": [{ "type": "string" }, { "type": "boolean" }] },
                          "example": {
                            "X-Frame-Options": "DENY",
                            "X-Content-Type-Options": "nosniff",
                            "Strict-Transport-Security": false
                          }
                        },
                        "lastScan": {
                          "type": "object",
                          "nullable": true,
                          "properties": {
                            "timestamp": { "type": "string" },
                            "threats": { "type": "integer" },
                            "files": { "type": "integer" }
                          }
                        }
                      }
                    },
                    "message": { "type": "string" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/security/ip-blocklist": {
      "post": {
        "tags": ["Security"],
        "summary": "Update IP blocklist",
        "description": "Add or remove IP addresses from the nginx deny rules.",
        "operationId": "updateIpBlocklist",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["ips", "action"],
                "properties": {
                  "ips": {
                    "type": "array",
                    "items": { "type": "string" },
                    "example": ["1.2.3.4", "5.6.7.0/24"]
                  },
                  "action": { "type": "string", "enum": ["add", "remove"], "example": "add" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/security/headers": {
      "patch": {
        "tags": ["Security"],
        "summary": "Update security headers",
        "description": "Configure nginx security headers (HSTS, X-Frame-Options, CSP, etc.) for a domain.",
        "operationId": "updateSecurityHeaders",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["headers"],
                "properties": {
                  "headers": {
                    "type": "object",
                    "additionalProperties": { "oneOf": [{ "type": "string" }, { "type": "boolean" }] },
                    "example": {
                      "X-Frame-Options": "DENY",
                      "X-Content-Type-Options": "nosniff",
                      "Strict-Transport-Security": "max-age=31536000; includeSubDomains"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/domains/{domainId}/security/scan": {
      "post": {
        "tags": ["Security"],
        "summary": "Run malware scan",
        "description": "Scan domain files for common malware patterns and suspicious code.",
        "operationId": "runMalwareScan",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" },
          { "$ref": "#/components/parameters/DomainId" }
        ],
        "responses": {
          "200": {
            "description": "Scan results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": {
                      "type": "object",
                      "properties": {
                        "scannedFiles": { "type": "integer" },
                        "threats": { "type": "integer" },
                        "findings": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "file": { "type": "string" },
                              "line": { "type": "integer" },
                              "pattern": { "type": "string" },
                              "severity": { "type": "string", "enum": ["low", "medium", "high"] }
                            }
                          }
                        }
                      }
                    },
                    "message": { "type": "string" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/cloudflare": {
      "get": {
        "tags": ["Cloudflare"],
        "summary": "Get Cloudflare connection status",
        "operationId": "getCloudflareStatus",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": {
            "description": "Cloudflare status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "connected": { "type": "boolean" },
                    "domain": { "type": "string", "nullable": true, "example": "example.com" },
                    "zoneId": { "type": "string", "nullable": true },
                    "devMode": { "type": "boolean" }
                  }
                }
              }
            }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      },
      "post": {
        "tags": ["Cloudflare"],
        "summary": "Connect Cloudflare",
        "description": "Verify a Cloudflare API token and optionally connect a zone. If no zoneId is provided, returns the available zones for selection.",
        "operationId": "connectCloudflare",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["apiToken"],
                "properties": {
                  "apiToken": { "type": "string", "description": "Cloudflare API token" },
                  "zoneId": { "type": "string", "description": "Zone ID to connect (optional, omit to list zones)" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Connected or zones returned",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "message": { "type": "string" },
                    "domain": { "type": "string" },
                    "zones": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": { "type": "string" },
                          "name": { "type": "string" },
                          "status": { "type": "string" }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      },
      "delete": {
        "tags": ["Cloudflare"],
        "summary": "Disconnect Cloudflare",
        "operationId": "disconnectCloudflare",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/cloudflare/dns": {
      "get": {
        "tags": ["Cloudflare"],
        "summary": "Get DNS records",
        "description": "List all Cloudflare DNS records for the connected zone.",
        "operationId": "getCloudflareDns",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": {
            "description": "DNS records",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "records": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": { "type": "string" },
                          "type": { "type": "string", "example": "A" },
                          "name": { "type": "string", "example": "example.com" },
                          "content": { "type": "string", "example": "1.2.3.4" },
                          "proxied": { "type": "boolean" },
                          "ttl": { "type": "integer" }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/cloudflare/purge-cache": {
      "post": {
        "tags": ["Cloudflare"],
        "summary": "Purge Cloudflare cache",
        "description": "Purge all cached content for the connected Cloudflare zone.",
        "operationId": "purgeCloudflareCache",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/cloudflare/analytics": {
      "get": {
        "tags": ["Cloudflare"],
        "summary": "Get Cloudflare analytics",
        "description": "Get traffic analytics from Cloudflare for the connected zone.",
        "operationId": "getCloudflareAnalytics",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "responses": {
          "200": {
            "description": "Analytics data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": { "type": "boolean" },
                    "data": { "type": "object" }
                  }
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    },
    "/api/hosting/accounts/{accountId}/cloudflare/dev-mode": {
      "post": {
        "tags": ["Cloudflare"],
        "summary": "Toggle development mode",
        "description": "Enable or disable Cloudflare development mode (bypasses cache for 3 hours).",
        "operationId": "toggleCloudflareDevMode",
        "parameters": [
          { "$ref": "#/components/parameters/AccountId" }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["enabled"],
                "properties": {
                  "enabled": { "type": "boolean", "example": true }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/Success" },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API token generated from Dashboard > Settings > Security. Pass in the Authorization header as: Authorization: Bearer dk_..."
      }
    },
    "parameters": {
      "AccountId": {
        "name": "accountId",
        "in": "path",
        "required": true,
        "schema": { "type": "integer" },
        "description": "The hosting account ID",
        "example": 1
      },
      "DomainId": {
        "name": "domainId",
        "in": "path",
        "required": true,
        "schema": { "type": "integer" },
        "description": "The domain ID",
        "example": 42
      },
      "BackupId": {
        "name": "backupId",
        "in": "path",
        "required": true,
        "schema": { "type": "integer" },
        "description": "The backup ID",
        "example": 10
      },
      "ServiceName": {
        "name": "service",
        "in": "path",
        "required": true,
        "schema": { "type": "string" },
        "description": "The service name (e.g., web, db, redis, ssh)",
        "example": "web"
      }
    },
    "schemas": {
      "User": {
        "type": "object",
        "properties": {
          "id": { "type": "integer", "example": 1 },
          "email": { "type": "string", "format": "email", "example": "user@example.com" },
          "name": { "type": "string", "example": "John Doe" },
          "emailVerified": { "type": "boolean", "example": true },
          "createdAt": { "type": "string", "format": "date-time" },
          "updatedAt": { "type": "string", "format": "date-time" }
        }
      },
      "Product": {
        "type": "object",
        "properties": {
          "id": { "type": "integer", "example": 1 },
          "name": { "type": "string", "example": "Web Hosting" },
          "slug": { "type": "string", "example": "web-hosting" },
          "description": { "type": "string", "example": "Fast and reliable web hosting for PHP, Node.js, and static sites." },
          "plans": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/Plan" }
          }
        }
      },
      "Plan": {
        "type": "object",
        "properties": {
          "id": { "type": "integer", "example": 1 },
          "name": { "type": "string", "example": "Starter" },
          "price": { "type": "number", "format": "float", "example": 5.99 },
          "period": { "type": "string", "example": "monthly" },
          "storage": { "type": "integer", "description": "Storage in MB", "example": 20480 },
          "bandwidth": { "type": "integer", "description": "Bandwidth in MB", "example": 1024000 },
          "domains": { "type": "integer", "description": "Max number of domains", "example": 3 },
          "databases": { "type": "integer", "description": "Max number of databases", "example": 999 },
          "memory": { "type": "integer", "description": "Memory limit in MB", "example": 1024 },
          "cpu": { "type": "number", "format": "float", "description": "CPU allocation as percentage", "example": 25 },
          "features": {
            "type": "array",
            "items": { "type": "string" },
            "example": ["Free SSL", "SSH Access", "Daily Backups"]
          }
        }
      },
      "HostingAccount": {
        "type": "object",
        "properties": {
          "id": { "type": "integer", "example": 1 },
          "label": { "type": "string", "example": "My Website" },
          "username": { "type": "string", "example": "user_abc123" },
          "status": { "type": "string", "enum": ["PROVISIONING", "ACTIVE", "SUSPENDED", "TERMINATED"], "example": "ACTIVE" },
          "plan": { "$ref": "#/components/schemas/Plan" },
          "domains": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/Domain" }
          },
          "siteType": { "type": "string", "enum": ["PHP", "NODEJS", "WORDPRESS", "LARAVEL"], "example": "WORDPRESS" },
          "createdAt": { "type": "string", "format": "date-time" },
          "updatedAt": { "type": "string", "format": "date-time" }
        }
      },
      "Domain": {
        "type": "object",
        "properties": {
          "id": { "type": "integer", "example": 42 },
          "name": { "type": "string", "example": "example.com" },
          "testSubdomain": { "type": "string", "example": "example-com", "description": "The *.deploybase.io test subdomain" },
          "isPrimary": { "type": "boolean", "example": true },
          "isActive": { "type": "boolean", "example": true },
          "sslStatus": { "type": "string", "enum": ["NONE", "PENDING", "ACTIVE", "FAILED"], "example": "ACTIVE" },
          "documentRoot": { "type": "string", "example": "/" },
          "domainType": { "type": "string", "enum": ["PHP", "NODEJS", "WORDPRESS", "LARAVEL"], "example": "PHP" },
          "nodeVersion": { "type": "string", "nullable": true, "example": "20" },
          "gitRepoUrl": { "type": "string", "nullable": true },
          "gitBranch": { "type": "string", "nullable": true },
          "gitAutoDeploy": { "type": "boolean", "example": false },
          "createdAt": { "type": "string", "format": "date-time" },
          "updatedAt": { "type": "string", "format": "date-time" }
        }
      },
      "ContainerStatus": {
        "type": "object",
        "properties": {
          "status": { "type": "string", "enum": ["running", "stopped", "restarting", "error"], "example": "running" },
          "uptime": { "type": "string", "example": "3 days" },
          "services": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "status": { "type": "string" },
                "port": { "type": "integer" }
              }
            }
          }
        }
      },
      "FileManagerInfo": {
        "type": "object",
        "properties": {
          "url": { "type": "string", "example": "https://files-mysite.deploybase.io" },
          "username": { "type": "string", "example": "user_abc123" },
          "password": { "type": "string", "example": "generated_password" }
        }
      },
      "PhpSettings": {
        "type": "object",
        "properties": {
          "memory_limit": { "type": "string", "example": "128M" },
          "max_execution_time": { "type": "string", "example": "30" },
          "max_input_time": { "type": "string", "example": "60" },
          "upload_max_filesize": { "type": "string", "example": "32M" },
          "post_max_size": { "type": "string", "example": "32M" },
          "max_input_vars": { "type": "string", "example": "1000" },
          "display_errors": { "type": "string", "example": "Off" },
          "error_reporting": { "type": "string", "example": "E_ALL & ~E_NOTICE & ~E_DEPRECATED" }
        },
        "additionalProperties": { "type": "string" }
      },
      "CronJob": {
        "type": "object",
        "required": ["schedule", "command"],
        "properties": {
          "schedule": { "type": "string", "example": "*/5 * * * *", "description": "Cron schedule expression" },
          "command": { "type": "string", "example": "/usr/bin/php /app/artisan schedule:run" }
        }
      },
      "SshCredentials": {
        "type": "object",
        "properties": {
          "enabled": { "type": "boolean", "example": true },
          "username": { "type": "string", "example": "user_abc123" },
          "hasPassword": { "type": "boolean", "example": true, "description": "Whether SSH password is set (password itself is not returned for security)" },
          "port": { "type": "integer", "example": 22001 },
          "host": { "type": "string", "example": "ssh.deploybase.io" },
          "type": { "type": "string", "example": "ssh" },
          "connectionString": { "type": "string", "example": "ssh user_abc123@ssh.deploybase.io -p 22001" }
        }
      },
      "SshKey": {
        "type": "object",
        "properties": {
          "fingerprint": { "type": "string", "example": "SHA256:abcdef123456..." },
          "label": { "type": "string", "example": "My MacBook" },
          "type": { "type": "string", "example": "ssh-ed25519" },
          "addedAt": { "type": "string", "format": "date-time" }
        }
      },
      "Database": {
        "type": "object",
        "properties": {
          "name": { "type": "string", "example": "myapp_production" },
          "username": { "type": "string", "example": "myapp_user" },
          "password": { "type": "string", "example": "generated_password" },
          "host": { "type": "string", "example": "db" },
          "port": { "type": "integer", "example": 3306 },
          "type": { "type": "string", "enum": ["MYSQL", "POSTGRESQL"], "example": "MYSQL" }
        }
      },
      "Backup": {
        "type": "object",
        "properties": {
          "id": { "type": "integer", "example": 10 },
          "type": { "type": "string", "enum": ["FULL", "FILES", "DATABASE"], "example": "FULL" },
          "status": { "type": "string", "enum": ["PENDING", "IN_PROGRESS", "COMPLETED", "FAILED"], "example": "COMPLETED" },
          "sizeMB": { "type": "number", "format": "float", "example": 245.8 },
          "createdAt": { "type": "string", "format": "date-time" },
          "expiresAt": { "type": "string", "format": "date-time" }
        }
      },
      "BackupSchedule": {
        "type": "object",
        "properties": {
          "enabled": { "type": "boolean", "example": true },
          "frequency": { "type": "string", "enum": ["daily", "2days", "weekly"], "example": "daily" },
          "time": { "type": "integer", "minimum": 0, "maximum": 23, "example": 2, "description": "Hour of day (0-23) in UTC" },
          "type": { "type": "string", "enum": ["FULL", "FILES", "DATABASE"], "example": "FULL" },
          "retention": { "type": "integer", "minimum": 1, "maximum": 5, "example": 3, "description": "Number of backups to retain" }
        }
      },
      "UsageStat": {
        "type": "object",
        "properties": {
          "used": { "type": "number", "format": "float", "example": 256.5, "description": "Used amount in MB" },
          "total": { "type": "number", "format": "float", "example": 5120.0, "description": "Total allocated in MB" },
          "percent": { "type": "number", "format": "float", "example": 5.01, "description": "Usage percentage" }
        }
      },
      "Deployment": {
        "type": "object",
        "properties": {
          "id": { "type": "integer", "example": 42 },
          "status": { "type": "string", "enum": ["PENDING", "IN_PROGRESS", "SUCCESS", "FAILED"], "example": "SUCCESS" },
          "commitHash": { "type": "string", "example": "a1b2c3d4" },
          "commitMessage": { "type": "string", "example": "Fix login bug" },
          "branch": { "type": "string", "example": "main" },
          "logs": { "type": "string", "nullable": true },
          "duration": { "type": "integer", "description": "Duration in seconds", "example": 45 },
          "createdAt": { "type": "string", "format": "date-time" },
          "completedAt": { "type": "string", "format": "date-time", "nullable": true }
        }
      },
      "Service": {
        "type": "object",
        "properties": {
          "name": { "type": "string", "example": "web" },
          "status": { "type": "string", "enum": ["running", "stopped", "restarting", "error"], "example": "running" },
          "memoryMB": { "type": "number", "format": "float", "example": 128.5 },
          "cpuPercent": { "type": "number", "format": "float", "example": 2.3 },
          "uptime": { "type": "string", "example": "3 days, 4 hours" }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": { "type": "boolean", "example": true },
          "message": { "type": "string", "example": "Resource not found" }
        }
      },
      "SuccessResponse": {
        "type": "object",
        "properties": {
          "success": { "type": "boolean", "example": true },
          "message": { "type": "string", "example": "Operation completed successfully" }
        }
      }
    },
    "responses": {
      "Success": {
        "description": "Operation completed successfully",
        "content": {
          "application/json": {
            "schema": { "$ref": "#/components/schemas/SuccessResponse" }
          }
        }
      },
      "BadRequest": {
        "description": "Invalid request parameters or body",
        "content": {
          "application/json": {
            "schema": { "$ref": "#/components/schemas/Error" },
            "example": { "error": true, "message": "Validation failed: field is required" }
          }
        }
      },
      "Unauthorized": {
        "description": "Authentication required or token is invalid",
        "content": {
          "application/json": {
            "schema": { "$ref": "#/components/schemas/Error" },
            "example": { "error": true, "message": "Authentication required" }
          }
        }
      },
      "NotFound": {
        "description": "The requested resource was not found",
        "content": {
          "application/json": {
            "schema": { "$ref": "#/components/schemas/Error" },
            "example": { "error": true, "message": "Resource not found" }
          }
        }
      }
    }
  }
}
