Files
ux_aura_assistant/References/manager_api.json
2026-03-25 01:21:37 +05:30

1 line
109 KiB
JSON

{"openapi":"3.0.0","info":{"title":"AI Studio Manager API","version":"1.0.0","description":"API for AI Studio Manager including authentication and app builder functionality"},"servers":[{"url":"/api/ai_studio_manager_api","description":"Auth API Base Path"},{"url":"/api","description":"App Builder API Base Path"}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key","description":"API key for authorization"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Bearer token for authorization"},"CookieAuth":{"type":"apiKey","in":"cookie","name":"auth","description":"Authentication cookie (encrypted)"},"StudioCookieAuth":{"type":"apiKey","in":"query","name":"X-Studio-Cookie","description":"Base64-encoded encrypted cookie for Google AI Studio"}}},"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"tags":[{"name":"Authentication","description":"Authentication and user management endpoints"},{"name":"App Builder","description":"App builder endpoints for managing applications and repositories"},{"name":"CMS","description":"Content Management System endpoints for managing companies, projects, and components"},{"name":"Work Management","description":"Work management endpoints for managing tasks"},{"name":"RBAC","description":"Role-Based Access Control endpoints for managing roles, permissions, and user assignments"}],"paths":{"/health":{"get":{"summary":"Health check endpoint","description":"Returns the status of the API","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"responses":{"200":{"description":"API is running","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"ok"},"message":{"type":"string","example":"Auth SecureChat API is running"},"version":{"type":"string","example":"1.0.0"}}}}}}}}},"/auth/validate":{"get":{"summary":"Validate authentication token (GET)","description":"Validates the auth token parameter via query parameter","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"auth","in":"query","description":"Authentication token","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Authentication successful","content":{"application/json":{"schema":{"type":"object","properties":{"firstname":{"type":"string","example":"John"},"lastname":{"type":"string","example":"Doe"},"email":{"type":"string","example":"john.doe@example.com"}}}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Authentication failed"}}}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Authentication failed"}}}}}}}},"post":{"summary":"Validate authentication token (POST)","description":"Validates the auth token parameter via request body","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["auth"],"properties":{"auth":{"type":"string","description":"Authentication token"}}}}}},"responses":{"200":{"description":"Authentication successful","content":{"application/json":{"schema":{"type":"object","properties":{"firstname":{"type":"string","example":"John"},"lastname":{"type":"string","example":"Doe"},"email":{"type":"string","example":"john.doe@example.com"}}}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Authentication failed"}}}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Authentication failed"}}}}}}}}},"/auth/decrypt-and-save":{"post":{"summary":"Decrypt auth token and save user data to database","description":"Decrypts the provided auth token and saves the user data to the D1 database","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["auth"],"properties":{"auth":{"type":"string","description":"Authentication token to decrypt"}}}}}},"responses":{"200":{"description":"User data successfully saved","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"message":{"type":"string","example":"User data saved successfully"},"updated":{"type":"boolean","example":false},"uid":{"type":"string","example":"426bcea5-adb9-4580-a8ca-3a40fdb0ef85"},"userData":{"type":"object","properties":{"uid":{"type":"string","example":"426bcea5-adb9-4580-a8ca-3a40fdb0ef85"},"email":{"type":"string","example":"humanizeiq@eteaminc.com"},"firebase_uid":{"type":"string","example":"wFyjGE1j8wclXayUvPbkF4c15f92"},"firstname":{"type":"string","example":"Rajeev"},"lastname":{"type":"string","example":"Borborah"},"company_name":{"type":"string","nullable":true,"example":null}}}}}}}},"401":{"description":"Authentication failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Invalid auth parameter"}}}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Failed to save user data"}}}}}}}}},"/app-builder/apps":{"get":{"summary":"Get all apps","description":"Retrieves all apps from the database (no user filter)","tags":["App Builder"],"security":[{"ApiKeyAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]}],"responses":{"200":{"description":"List of apps","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"my-app"},"createdBy":{"type":"string","example":"user@example.com"},"createdAt":{"type":"string","format":"date-time","example":"2025-01-01T12:00:00Z"},"userId":{"type":"string","example":"user123"}}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Unauthorized"}}}}}}}},"post":{"summary":"Create a new app","description":"Creates a new app entry in the database. App names must be unique across all users.","tags":["App Builder"],"security":[{"ApiKeyAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["appName"],"properties":{"appName":{"type":"string","example":"my-app"}}}}}},"responses":{"201":{"description":"App created","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"App 'my-app' created successfully."},"appId":{"type":"integer","example":1}}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Authentication required. Please provide valid credentials."}}}}}},"409":{"description":"App already exists","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"An app with this name already exists."}}}}}}}}},"/app-builder/add-github-webhook":{"post":{"summary":"Add or update webhook in GitHub repository","description":"Adds a webhook to the specified GitHub repository. If the webhook already exists, it updates the webhook to match current specifications. The webhook URL is https://services.nonprod.svchub.com/git_webhooks/github_cloner with content type application/json, SSL verification enabled, webhook secret from WEBHOOK_SECRET environment variable, and sends all events.","tags":["App Builder"],"security":[{"ApiKeyAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["appName"],"properties":{"appName":{"type":"string","example":"my-app","description":"Name of the app/repository"}}}}}},"responses":{"200":{"description":"Webhook updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Webhook updated successfully"},"alreadyExists":{"type":"boolean","example":true},"webhook":{"type":"object","properties":{"id":{"type":"number","example":123456},"url":{"type":"string","example":"https://services.nonprod.svchub.com/git_webhooks/github_cloner"},"events":{"type":"array","items":{"type":"string"},"example":["*"]},"active":{"type":"boolean","example":true}}}}}}}},"201":{"description":"Webhook created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Webhook created successfully"},"alreadyExists":{"type":"boolean","example":false},"webhook":{"type":"object","properties":{"id":{"type":"number","example":123456},"url":{"type":"string","example":"https://services.nonprod.svchub.com/git_webhooks/github_cloner"},"events":{"type":"array","items":{"type":"string"},"example":["*"]},"active":{"type":"boolean","example":true}}}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"appName is required."}}}}}},"401":{"description":"Authentication or credentials error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"GitHub credentials are invalid. Please update your credentials."}}}}}},"404":{"description":"Repository or credentials not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"GitHub repository not found. Please ensure the repository exists."}}}}}}}}},"/app-builder/github-credentials":{"get":{"summary":"Get GitHub credentials","description":"Retrieves the saved GitHub username (token is never returned)","tags":["App Builder"],"security":[{"ApiKeyAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]}],"responses":{"200":{"description":"GitHub username","content":{"application/json":{"schema":{"type":"object","properties":{"username":{"type":"string","example":"jane-doe"}}}}}},"404":{"description":"Credentials not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Credentials not found for this user."}}}}}}}},"post":{"summary":"Save GitHub credentials","description":"Saves or updates GitHub username and personal access token","tags":["App Builder"],"security":[{"ApiKeyAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["username","token"],"properties":{"username":{"type":"string","example":"jane-doe"},"token":{"type":"string","example":"ghp_xxxxxxxxxxxx"}}}}}},"responses":{"200":{"description":"Credentials saved","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Credentials saved successfully."}}}}}},"400":{"description":"Invalid credentials","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Invalid username or token provided."}}}}}}}}},"/app-builder/check-github-repo":{"post":{"summary":"Check GitHub repository existence","description":"Checks if a repository exists using stored GitHub credentials","tags":["App Builder"],"security":[{"ApiKeyAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["appName"],"properties":{"appName":{"type":"string","example":"my-app"}}}}}},"responses":{"200":{"description":"Repository check result","content":{"application/json":{"schema":{"type":"object","properties":{"exists":{"type":"boolean","example":true}}}}}},"401":{"description":"Invalid credentials","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"GitHub credentials are invalid. Please update your credentials."}}}}}},"404":{"description":"No credentials found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"No GitHub credentials found. Please save your credentials first."}}}}}}}}},"/app-builder/check-gitea-repo":{"get":{"summary":"Check Gitea repository existence","description":"Checks if a repository exists in HumanizeIQ Gitea","tags":["App Builder"],"security":[{"ApiKeyAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]}],"parameters":[{"name":"appName","in":"query","required":true,"schema":{"type":"string"},"example":"my-cool-app"}],"responses":{"200":{"description":"Repository check result","content":{"application/json":{"schema":{"type":"object","properties":{"exists":{"type":"boolean","example":false}}}}}}}}},"/app-builder/add-gitea-webhook":{"post":{"summary":"Add or update webhook in Gitea repository","description":"Adds a webhook to the specified Gitea repository. If the webhook already exists, it updates the webhook to match current specifications. The webhook URL is https://services.nonprod.svchub.com/git_webhooks/gitea with content type application/json, triggers on push and pull request closed events for all branches, and includes Bearer system-key authorization header.","tags":["App Builder"],"security":[{"ApiKeyAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["appName"],"properties":{"appName":{"type":"string","example":"my-app","description":"Name of the app/repository"}}}}}},"responses":{"200":{"description":"Webhook updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Webhook updated successfully"},"alreadyExists":{"type":"boolean","example":true},"webhook":{"type":"object","properties":{"id":{"type":"number","example":123},"url":{"type":"string","example":"https://services.nonprod.svchub.com/git_webhooks/gitea"},"events":{"type":"array","items":{"type":"string"},"example":["push","pull_request_closed"]},"branch_filter":{"type":"string","example":"*"},"active":{"type":"boolean","example":true}}}}}}}},"201":{"description":"Webhook created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Webhook created successfully"},"alreadyExists":{"type":"boolean","example":false},"webhook":{"type":"object","properties":{"id":{"type":"number","example":123},"url":{"type":"string","example":"https://services.nonprod.svchub.com/git_webhooks/gitea"},"events":{"type":"array","items":{"type":"string"},"example":["push","pull_request_closed"]},"branch_filter":{"type":"string","example":"*"},"active":{"type":"boolean","example":true}}}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"appName is required."}}}}}},"404":{"description":"Repository not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Gitea repository not found. Please ensure the repository exists."}}}}}}}}},"/app-builder/gitea-pull-requests":{"get":{"tags":["App Builder"],"summary":"Get open pull requests from Gitea","description":"Retrieves all open pull requests for a component's Gitea repository","security":[{"ApiKeyAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]}],"parameters":[{"name":"componentId","in":"query","required":true,"description":"Component ID to fetch pull requests for","schema":{"type":"integer","example":201}}],"responses":{"200":{"description":"Pull requests retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"pullRequests":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","example":12345},"number":{"type":"integer","example":42},"title":{"type":"string","example":"Merge playtest into dev"},"state":{"type":"string","example":"open"},"url":{"type":"string","example":"https://git.code.svchub.com/HumanizeIQ/repo/pulls/42"},"sourceBranch":{"type":"string","example":"playtest"},"targetBranch":{"type":"string","example":"dev"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"author":{"type":"string","example":"username"},"mergeable":{"type":"boolean","example":true},"merged":{"type":"boolean","example":false},"draft":{"type":"boolean","example":false},"envName":{"type":"string","example":"NonProd","nullable":true},"environment":{"type":"string","example":"dev","nullable":true}}}},"count":{"type":"integer","example":1}}}}}},"400":{"description":"Bad request - missing or invalid componentId","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"componentId query parameter is required."}}}}}},"401":{"description":"Unauthorized - authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Authentication required. Please provide valid credentials."}}}}}},"404":{"description":"Component or repository not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Component not found."}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"An unexpected error occurred while fetching pull requests. Please try again."}}}}}}}}},"/app-builder/gitea-pr-status":{"get":{"summary":"Get Gitea pull request status","description":"Gets the status of a specific pull request by ID, including merge status, state, conflict status, and branch information.","tags":["App Builder"],"security":[{"ApiKeyAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]}],"parameters":[{"name":"appName","in":"query","required":true,"schema":{"type":"string"},"example":"my-app"},{"name":"prId","in":"query","required":true,"schema":{"type":"integer"},"example":1}],"responses":{"200":{"description":"Pull request status retrieved","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"pr":{"type":"object","properties":{"id":{"type":"integer","example":1},"title":{"type":"string","example":"Feature: Add new functionality"},"state":{"type":"string","example":"open"},"merged":{"type":"boolean","example":false},"mergeable":{"type":"boolean","example":true},"hasConflicts":{"type":"boolean","example":false,"description":"True when mergeable is false, indicating merge conflicts"},"base":{"type":"string","example":"main"},"head":{"type":"string","example":"dev"},"created_at":{"type":"string","example":"2025-01-01T12:00:00Z"},"updated_at":{"type":"string","example":"2025-01-02T12:00:00Z"},"merged_at":{"type":"string","nullable":true,"example":null},"html_url":{"type":"string","example":"https://git.code.svchub.com/HumanizeIQ/gais_my_app/pulls/1"}}}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"appName query parameter is required."}}}}}},"404":{"description":"Pull request not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Pull request not found. Please check the PR ID and app name."}}}}}}}}},"/app-builder/merge-gitea-pr":{"post":{"summary":"Merge and close Gitea pull request","description":"Initiates an asynchronous merge of a pull request in Gitea using merge commit strategy with force merge enabled. Returns immediately with status 202. Automatically creates route entries: playtest→dev creates dev route in ROUTES_DB (services.nonprod.svchub.com/{app_name}), dev→main creates prod route in ROUTES_DB_PROD (services.prod.svchub.com/{app_name}). Use the PR status endpoint to check merge completion.","tags":["App Builder"],"security":[{"ApiKeyAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["appName","prId"],"properties":{"appName":{"type":"string","example":"my-app"},"prId":{"type":"integer","example":1,"description":"Pull request ID/number"}}}}}},"responses":{"202":{"description":"Pull request merge initiated","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Pull request #1 merge initiated. Use the PR status endpoint to check merge status."},"prId":{"type":"integer","example":1},"initiated":{"type":"boolean","example":true}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"appName is required."}}}}}},"404":{"description":"Pull request not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Pull request not found. Please check the PR ID and app name."}}}}}},"405":{"description":"Pull request cannot be merged","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Cannot merge PR: PR is not mergeable"}}}}}},"409":{"description":"Pull request already merged","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Pull request has already been merged."}}}}}}}}},"/app-builder/redeploy-app":{"post":{"summary":"Redeploy an app","description":"Triggers a redeploy of an app on a specific branch by calling {GITEA_WEBHOOK_BASE_URL}/redeploy with Authorization Bearer token and X-GitHub-Event header (base URL configurable via GITEA_WEBHOOK_BASE_URL, auth token via GITEA_WEBHOOK_AUTH_TOKEN)","tags":["App Builder"],"security":[{"ApiKeyAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["appName","branch"],"properties":{"appName":{"type":"string","example":"my-app","description":"Name of the app to redeploy"},"branch":{"type":"string","enum":["main","dev","playtest"],"example":"main","description":"Branch to deploy (main, dev, or playtest)"}}}}}},"responses":{"200":{"description":"Redeploy triggered successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Redeploy triggered successfully for gais_my_app on branch main"},"repositoryName":{"type":"string","example":"gais_my_app"},"branch":{"type":"string","example":"main"},"cloneUrl":{"type":"string","example":"https://git.code.svchub.com/HumanizeIQ/gais_my_app"}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"appName is required."}}}}}},"502":{"description":"Redeploy service error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Redeploy service error: 500 - Internal Server Error"}}}}}}}}},"/app-builder/force-deploy":{"post":{"summary":"Force deploy an app","description":"Triggers a force deploy workflow for an app via webhook service. This bypasses normal deployment checks and forces a deployment for a specific PR.","tags":["App Builder"],"security":[{"ApiKeyAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["appName","prId"],"properties":{"appName":{"type":"string","example":"my-app","description":"Name of the app/repository"},"prId":{"type":"integer","example":1,"description":"Pull request ID/number"}}}}}},"responses":{"200":{"description":"Force deploy workflow triggered successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Force deploy workflow triggered successfully for gais_my_app"},"appName":{"type":"string","example":"my-app"},"prId":{"type":"integer","example":1},"repository":{"type":"string","example":"HumanizeIQ/gais_my_app"},"httpStatus":{"type":"integer","example":204},"giteaResponse":{"type":"string","nullable":true}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"appName is required."}}}}}},"403":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Unauthorized: Invalid webhook authentication token"}}}}}},"404":{"description":"Webhook endpoint not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Force deploy webhook endpoint not found"}}}}}}}}},"/app-builder/create-defect-issue":{"post":{"summary":"Create a defect issue","description":"Creates a defect issue in the Gitea repository for an app with optional file attachments. Attachments are uploaded first, then linked in the issue body.","tags":["App Builder"],"security":[{"ApiKeyAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["appName","title"],"properties":{"appName":{"type":"string","example":"my-app","description":"Name of the app/repository"},"title":{"type":"string","example":"Bug: Login button not working","description":"Issue title"},"description":{"type":"string","example":"When clicking the login button, nothing happens. Expected behavior: should redirect to dashboard.","description":"Issue description/body (optional)"},"attachments":{"type":"array","description":"Optional array of file attachments","items":{"type":"object","required":["name"],"properties":{"name":{"type":"string","example":"screenshot.png","description":"Filename with extension"},"type":{"type":"string","example":"image/png","description":"MIME type (optional, defaults to application/octet-stream)"},"data":{"type":"string","example":"iVBORw0KGgoAAAANSUhEUgAAAAUA...","description":"Base64 encoded file content (with or without data URI prefix)"}}}}}}}}},"responses":{"201":{"description":"Defect issue created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Defect issue #5 created successfully"},"issue":{"type":"object","properties":{"id":{"type":"integer","example":123},"number":{"type":"integer","example":5},"title":{"type":"string","example":"Bug: Login button not working"},"body":{"type":"string","example":"Description...\n\n### Attachments\n- [screenshot.png](https://...)"},"state":{"type":"string","example":"open"},"url":{"type":"string","example":"https://git.code.svchub.com/HumanizeIQ/gais_my_app/issues/5"},"created_at":{"type":"string","example":"2025-01-01T12:00:00Z"}}},"attachments":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","example":"screenshot.png"},"url":{"type":"string","example":"https://git.code.svchub.com/..."}}}}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"title is required."}}}}}},"403":{"description":"Access forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Access forbidden. Please check token permissions."}}}}}},"404":{"description":"Repository not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Repository not found. Please ensure the repository exists."}}}}}}}}},"/app-builder/create-gitea-repo":{"post":{"summary":"Create Gitea repository","description":"Creates a new repository in HumanizeIQ Gitea instance with three branches: main, dev, and playtest. Also saves the app to the database. App names must be unique - returns 409 if an app with the same name already exists.","tags":["App Builder"],"security":[{"ApiKeyAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["appName"],"properties":{"appName":{"type":"string","example":"my-app"}}}}}},"responses":{"201":{"description":"Repository created","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Repository 'gais_my_app' created successfully with branches: main, dev, playtest."},"url":{"type":"string","example":"https://git.code.svchub.com/HumanizeIQ/gais_my_app"},"branches":{"type":"array","items":{"type":"object","properties":{"branch":{"type":"string","example":"dev"},"created":{"type":"boolean","example":true},"alreadyExists":{"type":"boolean","example":false}}}}}}}}},"409":{"description":"App name already exists or repository already exists","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"A repository with this name already exists. Missing branches have been created."},"branches":{"type":"array","items":{"type":"object","properties":{"branch":{"type":"string","example":"dev"},"created":{"type":"boolean","example":false},"alreadyExists":{"type":"boolean","example":true}}}}}}}}}}}},"/app-builder/create-route":{"post":{"summary":"Create or update route entry","description":"Creates a new route entry in the routes database for playtest, nonprod, or prod environments. If a route already exists for the app, it updates the existing route. All URLs are configurable via BASE_URL and WORKER_DOMAIN environment variables.","tags":["App Builder"],"security":[{"ApiKeyAuth":[]},{"CookieAuth":[]},{"StudioCookieAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["appName"],"properties":{"appName":{"type":"string","example":"my-app","description":"Name of the app"},"environment":{"type":"string","enum":["playtest","nonprod","prod"],"default":"playtest","example":"playtest","description":"Environment to create route for (playtest, nonprod, or prod)"}}}}}},"responses":{"200":{"description":"Route updated","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Route for 'my-app' in nonprod environment updated successfully."},"url":{"type":"string","example":"https://services.nonprod.svchub.com/my_app"},"environment":{"type":"string","example":"nonprod"},"updated":{"type":"boolean","example":true}}}}}},"201":{"description":"Route created","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Route for 'my-app' in playtest environment created successfully."},"url":{"type":"string","example":"https://services.nonprod.svchub.com/playtest/my_app"},"environment":{"type":"string","example":"playtest"},"updated":{"type":"boolean","example":false}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Invalid environment. Must be one of: playtest, nonprod, prod"}}}}}}}}},"/app-builder/organizations":{"get":{"tags":["App Builder"],"summary":"Get all organizations","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"responses":{"200":{"description":"List of organizations","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"},"created_at":{"type":"string","format":"date-time"}}}}}}}}},"post":{"tags":["App Builder"],"summary":"Create a new organization","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string"}}}}}},"responses":{"201":{"description":"Organization created","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"},"organization":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"},"created_at":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"}}}}}},"409":{"description":"Conflict - organization already exists","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"}}}}}}}},"patch":{"tags":["App Builder"],"summary":"Update an existing organization","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","name"],"properties":{"id":{"type":"integer","example":3},"name":{"type":"string","example":"Updated Org"},"description":{"type":"string","example":"Updated Description"}}}}}},"responses":{"200":{"description":"Organization updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Organization updated successfully."},"organization":{"type":"object","properties":{"id":{"type":"integer","example":3},"name":{"type":"string","example":"Updated Org"},"description":{"type":"string","example":"Updated Description"},"created_at":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Bad request - missing required fields","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Organization ID and name are required."}}}}}},"404":{"description":"Organization not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Organization not found"}}}}}},"409":{"description":"Conflict - organization name already exists","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Organization with this name already exists"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to update organization"}}}}}}}}},"/app-builder/projects":{"get":{"tags":["App Builder"],"summary":"Get all projects","description":"Retrieve all projects, optionally filtered by organization","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"organizationId","in":"query","description":"Filter projects by organization ID","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"List of projects","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"},"organizationId":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"}}}}}}},"400":{"description":"Bad request - invalid organizationId","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"}}}}}}}},"post":{"tags":["App Builder"],"summary":"Create a new project","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","organizationId"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"organizationId":{"type":"integer"}}}}}},"responses":{"201":{"description":"Project created","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"},"project":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"},"organizationId":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Bad request - missing required fields","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"}}}}}},"404":{"description":"Organization not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"}}}}}},"409":{"description":"Conflict - project already exists in organization","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"}}}}}}}},"patch":{"tags":["App Builder"],"summary":"Update a project","description":"Updates an existing project","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id"],"properties":{"id":{"type":"integer","example":103,"description":"Project ID"},"name":{"type":"string","example":"Updated Project Name","description":"Project name (optional)"},"description":{"type":"string","example":"Updated project description","description":"Project description (optional)"}}}}}},"responses":{"200":{"description":"Project updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Project updated successfully."},"project":{"type":"object","properties":{"id":{"type":"integer","example":103},"name":{"type":"string","example":"Updated Project"},"description":{"type":"string","example":"Updated Description"},"organization_id":{"type":"integer","example":1},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Bad request - missing or invalid data","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Project ID is required."}}}}}},"404":{"description":"Project not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Project not found."}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to update project"}}}}}}}}},"/cms/companies":{"get":{"tags":["CMS"],"summary":"Get all companies","description":"Retrieve all companies in the CMS","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"responses":{"200":{"description":"List of companies","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"eTeam"},"slug":{"type":"string","example":"eteam"},"description":{"type":"string","example":"eTeam Inc."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to fetch companies"}}}}}}}}},"/cms/companies/{companySlug}":{"get":{"tags":["CMS"],"summary":"Get company by slug","description":"Retrieve a specific company by its slug","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"companySlug","in":"path","required":true,"description":"Company slug identifier","schema":{"type":"string","example":"eteam"}}],"responses":{"200":{"description":"Company details","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"eTeam"},"slug":{"type":"string","example":"eteam"},"description":{"type":"string","example":"eTeam Inc."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}},"404":{"description":"Company not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Company not found"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to fetch company"}}}}}}}}},"/cms/companies/{companySlug}/projects":{"get":{"tags":["CMS"],"summary":"Get projects for a company","description":"Retrieve all projects for a specific company","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"companySlug","in":"path","required":true,"description":"Company slug identifier","schema":{"type":"string","example":"eteam"}}],"responses":{"200":{"description":"List of projects","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"Corporate Website"},"slug":{"type":"string","example":"corporate-web"},"description":{"type":"string","example":"Main corporate website"},"company_id":{"type":"integer","example":1},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}},"404":{"description":"Company not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Company not found"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to fetch projects"}}}}}}}}},"/cms/companies/{companySlug}/projects/{projectSlug}":{"get":{"tags":["CMS"],"summary":"Get project by slug","description":"Retrieve a specific project by its slug","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"companySlug","in":"path","required":true,"description":"Company slug identifier","schema":{"type":"string","example":"eteam"}},{"name":"projectSlug","in":"path","required":true,"description":"Project slug identifier","schema":{"type":"string","example":"corporate-web"}}],"responses":{"200":{"description":"Project details","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"Corporate Website"},"slug":{"type":"string","example":"corporate-web"},"description":{"type":"string","example":"Main corporate website"},"company_id":{"type":"integer","example":1},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}},"404":{"description":"Project not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Project not found"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to fetch project"}}}}}}}}},"/cms/companies/{companySlug}/projects/{projectSlug}/components":{"get":{"tags":["CMS"],"summary":"Get components for a project","description":"Retrieve all components for a specific project (metadata only, no fields)","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"companySlug","in":"path","required":true,"description":"Company slug identifier","schema":{"type":"string","example":"eteam"}},{"name":"projectSlug","in":"path","required":true,"description":"Project slug identifier","schema":{"type":"string","example":"corporate-web"}}],"responses":{"200":{"description":"List of components","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"Home Page"},"slug":{"type":"string","example":"homePage"},"project_id":{"type":"integer","example":1},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}},"404":{"description":"Project not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Project not found"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to fetch components"}}}}}}}}},"/cms/companies/{companySlug}/projects/{projectSlug}/components/{componentSlug}":{"get":{"tags":["CMS"],"summary":"Get component content","description":"Retrieve a specific component with its fields and content","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"companySlug","in":"path","required":true,"description":"Company slug identifier","schema":{"type":"string","example":"eteam"}},{"name":"projectSlug","in":"path","required":true,"description":"Project slug identifier","schema":{"type":"string","example":"corporate-web"}},{"name":"componentSlug","in":"path","required":true,"description":"Component slug identifier","schema":{"type":"string","example":"homePage"}}],"responses":{"200":{"description":"Component with fields","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"Home Page"},"slug":{"type":"string","example":"homePage"},"project_id":{"type":"integer","example":1},"fields":{"type":"array","description":"Array of field definitions with values","items":{"type":"object","properties":{"key":{"type":"string","example":"hero"},"label":{"type":"string","example":"Hero Section"},"type":{"type":"string","enum":["text","textarea","rich-text","image","video","link","number","boolean","date","icon-key","group","list","simple-list"],"example":"group"},"value":{"description":"Field value (type depends on field type)","oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array"},{"type":"object"},{"type":"null"}]},"subFields":{"type":"array","description":"Nested fields for group type","items":{"type":"object"}},"items":{"type":"array","description":"Array items for list type","items":{"type":"object"}}}},"example":[{"key":"hero","label":"Hero Section","type":"group","subFields":[{"key":"title","label":"Title","type":"text","value":"Welcome to eTeam"},{"key":"image","label":"Background Image","type":"image","value":"https://example.com/hero.jpg"}]}]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}},"404":{"description":"Component not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Component not found"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to fetch component"}}}}}}}}},"/app-builder/components/by-repo":{"get":{"tags":["App Builder"],"summary":"Get component by GitHub repo name","description":"Retrieve component definition based on the GitHub repository name (hiq_repo)","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"repoName","in":"query","description":"GitHub repository name (hiq_repo)","required":true,"schema":{"type":"string","example":"gais_humanizeiq_projectalpha_userservice"}}],"responses":{"200":{"description":"Component found","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer","example":201},"project_id":{"type":"integer","example":101},"name":{"type":"string","example":"user-service"},"title":{"type":"string","example":"User Management Service"},"type":{"type":"string","enum":["UX","API"],"example":"API"},"description":{"type":"string","example":"Handles user auth and profile"},"status":{"type":"string","enum":["Pending","Active","Inactive"],"example":"Active"},"created_at":{"type":"string","format":"date-time"},"additional_info":{"type":"object","properties":{"unique_app_code":{"type":"string","example":"humanizeiq_projectalpha_userservice","description":"Auto-generated, immutable code"},"slug":{"type":"string","example":"user-service"},"hiq_repo":{"type":"string","example":"gais_humanizeiq_projectalpha_userservice"},"supported_domains":{"type":"array","items":{"type":"string"},"example":["api.example.com"]},"ai_studio_link":{"type":"string","example":"https://aistudio.google.com/..."},"github_repo":{"type":"string","example":"web-dash"},"github_owner":{"type":"string","example":"org-name"}}}}}}}},"400":{"description":"Bad request - missing repoName","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"repoName query parameter is required."}}}}}},"404":{"description":"Component not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Component not found with the specified repo name."}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to fetch component"}}}}}}}}},"/app-builder/components/by-github-repo":{"get":{"tags":["App Builder"],"summary":"Get component by GitHub repo name","description":"Retrieve component definition based on the GitHub repository name (github_repo field)","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"githubRepo","in":"query","description":"GitHub repository name (github_repo)","required":true,"schema":{"type":"string","example":"web-dash"}}],"responses":{"200":{"description":"Component found","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer","example":201},"project_id":{"type":"integer","example":101},"name":{"type":"string","example":"user-service"},"title":{"type":"string","example":"User Management Service"},"type":{"type":"string","enum":["UX","API"],"example":"UX"},"description":{"type":"string","example":"User interface dashboard"},"status":{"type":"string","enum":["Pending","Active","Inactive"],"example":"Active"},"created_at":{"type":"string","format":"date-time"},"additional_info":{"type":"object","properties":{"unique_app_code":{"type":"string","example":"humanizeiq_projectalpha_userservice","description":"Auto-generated, immutable code"},"slug":{"type":"string","example":"user-service"},"hiq_repo":{"type":"string","example":"gais_humanizeiq_projectalpha_userservice"},"github_repo":{"type":"string","example":"web-dash"},"github_owner":{"type":"string","example":"org-name"},"supported_domains":{"type":"array","items":{"type":"string"},"example":["*.example.com"]},"ai_studio_link":{"type":"string","example":"https://aistudio.google.com/..."}}}}}}}},"400":{"description":"Bad request - missing githubRepo","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"githubRepo query parameter is required."}}}}}},"404":{"description":"Component not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Component not found with the specified GitHub repo name."}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to fetch component"}}}}}}}}},"/app-builder/components":{"get":{"tags":["App Builder"],"summary":"Get components for a project","description":"Retrieve all components for a specific project","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"projectId","in":"query","description":"Project ID to filter components","required":true,"schema":{"type":"integer","example":101}}],"responses":{"200":{"description":"List of components","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","example":201},"project_id":{"type":"integer","example":101},"name":{"type":"string","example":"user-service"},"title":{"type":"string","example":"User Management Service"},"type":{"type":"string","enum":["UX","API"],"example":"API"},"description":{"type":"string","example":"Handles user auth and profile"},"status":{"type":"string","enum":["Pending","Active","Inactive"],"example":"Active"},"created_at":{"type":"string","format":"date-time"},"additional_info":{"type":"object","properties":{"unique_app_code":{"type":"string","example":"humanizeiq_projectalpha_userservice","description":"Auto-generated, immutable code: organizationname_projectname_slug"},"slug":{"type":"string","example":"user-service"},"hiq_repo":{"type":"string","example":"user-service-repo"},"supported_domains":{"type":"array","items":{"type":"string"},"example":["api.example.com"]},"ai_studio_link":{"type":"string","example":"https://aistudio.google.com/..."},"github_repo":{"type":"string","example":"web-dash"},"github_owner":{"type":"string","example":"org-name"}}}}}}}}},"400":{"description":"Bad request - missing or invalid projectId","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"projectId query parameter is required."}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to fetch components"}}}}}}}},"post":{"tags":["App Builder"],"summary":"Create a new component","description":"Create a new component within a specific project","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["projectId","name","title","type","additional_info"],"properties":{"projectId":{"type":"integer","example":101},"name":{"type":"string","example":"reporting-service"},"title":{"type":"string","example":"Reporting Service"},"type":{"type":"string","enum":["UX","API"],"example":"API"},"description":{"type":"string","example":"Generates reports"},"additional_info":{"type":"object","required":["slug","supported_domains","hiq_repo"],"properties":{"slug":{"type":"string","example":"reporting-service"},"supported_domains":{"type":"array","items":{"type":"string"},"example":["*"]},"hiq_repo":{"type":"string","example":"reporting-repo"},"ai_studio_link":{"type":"string","description":"UX components only","example":"https://aistudio.google.com/..."},"github_repo":{"type":"string","description":"UX components only","example":"web-dash"},"github_owner":{"type":"string","description":"UX components only","example":"org-name"}}}}}}}},"responses":{"201":{"description":"Component created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Component created successfully."},"component":{"type":"object","properties":{"id":{"type":"integer","example":203},"project_id":{"type":"integer","example":101},"name":{"type":"string","example":"reporting-service"},"title":{"type":"string","example":"Reporting Service"},"type":{"type":"string","example":"API"},"description":{"type":"string","example":"Generates reports"},"status":{"type":"string","enum":["Pending","Active","Inactive"],"example":"Pending"},"created_at":{"type":"string","format":"date-time"},"additional_info":{"type":"object","properties":{"unique_app_code":{"type":"string","example":"humanizeiq_projectalpha_reportingservice","description":"Auto-generated, immutable"},"slug":{"type":"string","example":"reporting-service"},"hiq_repo":{"type":"string","example":"reporting-repo"},"supported_domains":{"type":"array","items":{"type":"string"},"example":["*"]}}}}}}}}}},"400":{"description":"Bad request - missing required fields or invalid type","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Project ID, name, title, and type are required."}}}}}},"404":{"description":"Project not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Project not found"}}}}}},"409":{"description":"Conflict - component with same name already exists","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Component with this name already exists in this project"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to create component"}}}}}}}},"patch":{"tags":["App Builder"],"summary":"Update an existing component","description":"Update an existing component within a specific project. All fields except id are optional.","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id"],"properties":{"id":{"type":"integer","example":203},"name":{"type":"string","example":"updated-service"},"title":{"type":"string","example":"Updated Service"},"type":{"type":"string","enum":["UX","API"],"example":"API"},"description":{"type":"string","example":"Updated description"},"status":{"type":"string","enum":["Pending","Active","Inactive"],"example":"Active","description":"Component status"},"additional_info":{"type":"object","properties":{"slug":{"type":"string","example":"updated-service"},"supported_domains":{"type":"array","items":{"type":"string"},"example":["*.example.com"]},"hiq_repo":{"type":"string","example":"updated-repo"},"ai_studio_link":{"type":"string","description":"UX components only","example":"https://aistudio.google.com/..."},"github_repo":{"type":"string","description":"UX components only","example":"web-dash"},"github_owner":{"type":"string","description":"UX components only","example":"org-name"}}}}}}}},"responses":{"200":{"description":"Component updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Component updated successfully."},"component":{"type":"object","properties":{"id":{"type":"integer","example":203},"project_id":{"type":"integer","example":101},"name":{"type":"string","example":"updated-service"},"title":{"type":"string","example":"Updated Service"},"type":{"type":"string","example":"API"},"description":{"type":"string","example":"Updated description"},"status":{"type":"string","enum":["Pending","Active","Inactive"],"example":"Active"},"created_at":{"type":"string","format":"date-time"},"additional_info":{"type":"object","properties":{"unique_app_code":{"type":"string","example":"humanizeiq_projectalpha_updatedservice","description":"Auto-generated, immutable (cannot be modified)"},"slug":{"type":"string","example":"updated-service"},"hiq_repo":{"type":"string","example":"updated-repo"},"supported_domains":{"type":"array","items":{"type":"string"},"example":["*.example.com"]}}}}}}}}}},"400":{"description":"Bad request - missing component ID or invalid type","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Component ID is required."}}}}}},"404":{"description":"Component not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Component not found"}}}}}},"409":{"description":"Conflict - component name already exists","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Component with this name already exists in this project"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to update component"}}}}}}}}},"/app-builder/components/{componentId}/invite-collaborator":{"post":{"tags":["App Builder"],"summary":"Invite user as GitHub collaborator","description":"Invite the authenticated user as a collaborator on the component's GitHub repository using the repository owner's credentials","security":[{"BearerAuth":[]}],"parameters":[{"name":"componentId","in":"path","description":"Component ID","required":true,"schema":{"type":"integer","example":36}}],"responses":{"200":{"description":"Collaborator invited successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Invitation sent to username"},"invited":{"type":"boolean","example":true},"alreadyCollaborator":{"type":"boolean","example":false},"repository":{"type":"string","example":"hiq-automation/craft-taskmanager"},"collaborator":{"type":"string","example":"github-username"}}}}}},"400":{"description":"Bad request - missing configuration or credentials","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Component does not have a GitHub repository configured"}}}}}},"401":{"description":"Unauthorized - authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","example":"Authentication required"}}}}}},"404":{"description":"Component or credentials not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Component not found"}}}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to invite collaborator"},"details":{"type":"string","example":"GitHub API error: 403 - ..."}}}}}}}}},"/app-builder/requirements":{"get":{"tags":["App Builder"],"summary":"Get requirements for a component","description":"Retrieve all requirements for a specific component","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"componentId","in":"query","description":"Component ID","required":true,"schema":{"type":"integer","example":201}}],"responses":{"200":{"description":"Requirements retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","example":301},"component_id":{"type":"integer","example":201},"type":{"type":"string","enum":["Feature","Defect","Enhancement","Task"],"example":"Feature"},"title":{"type":"string","example":"User Login"},"description":{"type":"string","example":"As a user, I want to login..."},"status":{"type":"string","enum":["New","Open","InProgress","Resolved","Closed"],"example":"Open"},"unique_hash":{"type":"string","example":"a1b2c3d4e5f6..."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}},"400":{"description":"Bad request - missing or invalid componentId","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"componentId query parameter is required and must be a valid number."}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to fetch requirements"}}}}}}}},"post":{"tags":["App Builder"],"summary":"Save requirements","description":"Create new or update existing requirements for a component","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["componentId","requirements"],"properties":{"componentId":{"type":"integer","example":201,"description":"Component ID"},"requirements":{"type":"array","description":"Array of requirements to save","items":{"type":"object","required":["type","title","status"],"properties":{"id":{"type":"integer","example":301,"description":"Optional - include for updates, omit for new requirements"},"type":{"type":"string","enum":["Feature","Defect","Enhancement","Task"],"example":"Feature"},"title":{"type":"string","example":"User Login"},"description":{"type":"string","example":"As a user, I want to login..."},"status":{"type":"string","enum":["New","Open","InProgress","Resolved","Closed"],"example":"Open"}}}}}}}}},"responses":{"200":{"description":"Requirements saved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Requirements saved successfully."},"requirements":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","example":301},"component_id":{"type":"integer","example":201},"type":{"type":"string","example":"Feature"},"title":{"type":"string","example":"User Login"},"description":{"type":"string","example":"As a user..."},"status":{"type":"string","example":"Open"},"unique_hash":{"type":"string","example":"a1b2c3d4e5f6..."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}}}},"400":{"description":"Bad request - validation error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Each requirement must have type, title, and status."}}}}}},"404":{"description":"Component not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Component not found."}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to save requirements"}}}}}}}}},"/app-builder/requirements/by-hash":{"get":{"tags":["App Builder"],"summary":"Get requirement by unique hash","description":"Retrieve a specific requirement using its unique hash identifier (SHA-256 hash of componentId-appCode-requirementId)","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"hash","in":"query","description":"Unique hash identifier for the requirement","required":true,"schema":{"type":"string","example":"a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456"}}],"responses":{"200":{"description":"Requirement retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"requirement":{"type":"object","properties":{"id":{"type":"integer","example":301},"component_id":{"type":"integer","example":201},"type":{"type":"string","example":"Feature"},"title":{"type":"string","example":"User Login"},"description":{"type":"string","example":"As a user, I want to login..."},"status":{"type":"string","example":"Open"},"unique_hash":{"type":"string","example":"a1b2c3d4e5f6..."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Bad request - missing hash parameter","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"hash query parameter is required."}}}}}},"404":{"description":"Requirement not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Requirement not found."}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to fetch requirement"}}}}}}}}},"/app-builder/requirements/backfill-hashes":{"post":{"tags":["App Builder"],"summary":"Backfill unique hashes for requirements","description":"Generates and updates unique_hash for all requirements that don't have it populated. This is useful for migrating existing data after adding the unique_hash feature.","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"responses":{"200":{"description":"Backfill completed successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"processed":{"type":"integer","example":25,"description":"Total requirements processed"},"updated":{"type":"integer","example":23,"description":"Requirements successfully updated with hash"},"skipped":{"type":"integer","example":2,"description":"Requirements skipped due to errors"},"message":{"type":"string","example":"Backfill complete: 23 updated, 2 skipped"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to backfill requirement hashes"},"details":{"type":"string","example":"Database connection error"}}}}}}}}},"/app-builder/requirements/{id}":{"patch":{"tags":["App Builder"],"summary":"Update a requirement","description":"Update individual fields of a requirement. Only the fields provided in the request body will be updated.","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","description":"Requirement ID","required":true,"schema":{"type":"integer","example":301}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["Feature","Defect","Enhancement","Task"],"example":"Feature","description":"Optional - Requirement type"},"title":{"type":"string","example":"Updated User Login","description":"Optional - Requirement title"},"description":{"type":"string","example":"Updated description for user login","description":"Optional - Requirement description"},"status":{"type":"string","enum":["New","Open","InProgress","Resolved","Closed"],"example":"Resolved","description":"Optional - Requirement status"}},"description":"At least one field must be provided"},"examples":{"Update status only":{"value":{"status":"Resolved"}},"Update multiple fields":{"value":{"status":"InProgress","description":"Working on implementing OAuth2 authentication"}}}}}},"responses":{"200":{"description":"Requirement updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Requirement updated successfully."},"requirement":{"type":"object","properties":{"id":{"type":"integer","example":301},"component_id":{"type":"integer","example":201},"type":{"type":"string","example":"Feature"},"title":{"type":"string","example":"User Login"},"description":{"type":"string","example":"As a user, I want to login..."},"status":{"type":"string","example":"Resolved"},"unique_hash":{"type":"string","example":"a1b2c3d4e5f6..."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Bad request - validation error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"No valid fields provided for update. Allowed fields: type, title, description, status"}}}}}},"404":{"description":"Requirement not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Requirement not found."}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to update requirement"},"details":{"type":"string","example":"Database error"}}}}}}}}},"/app-builder/get_requirements_from_code":{"get":{"tags":["App Builder"],"summary":"Get file from code repository","description":"Fetches a file from a specified folder in the Gitea repository (playtest branch)","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"hiq_repo","in":"query","description":"Gitea repository name in owner/repo format (e.g., HumanizeIQ/gais_myapp)","required":true,"schema":{"type":"string","example":"HumanizeIQ/gais_myapp"}},{"name":"folder","in":"query","description":"Folder path in the repository (optional, defaults to root)","required":false,"schema":{"type":"string","example":"docs"}},{"name":"file_name","in":"query","description":"Name of the file to fetch (optional, defaults to requirements.md)","required":false,"schema":{"type":"string","example":"requirements.md"}}],"responses":{"200":{"description":"File retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"content":{"type":"string","example":"# Requirements\n\n## Feature 1\n..."},"sha":{"type":"string","example":"abc123..."},"size":{"type":"integer","example":1024},"path":{"type":"string","example":"docs/requirements.md"},"name":{"type":"string","example":"requirements.md"}}}}}},"400":{"description":"Bad request - missing or invalid hiq_repo","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"hiq_repo query parameter is required."}}}}}},"404":{"description":"File not found in repository","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"File 'docs/requirements.md' not found in repository."}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to fetch file from repository."}}}}}}}}},"/app-builder/create-pull-request":{"post":{"tags":["App Builder"],"summary":"Create a pull request in Gitea","description":"Creates a pull request from playtest to dev or dev to main in the component's Gitea repository","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["componentId","targetBranch"],"properties":{"componentId":{"type":"integer","description":"Component ID","example":201},"targetBranch":{"type":"string","enum":["dev","main"],"description":"Target branch for the pull request (dev or main). Source branch is automatically determined: playtest→dev or dev→main","example":"dev"},"comment":{"type":"string","description":"Optional comment/description for the pull request","example":"Merging latest features from playtest"}}}}}},"responses":{"201":{"description":"Pull request created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Pull request created successfully."},"pullRequest":{"type":"object","properties":{"id":{"type":"integer","example":42},"number":{"type":"integer","example":5},"title":{"type":"string","example":"Merge playtest into dev"},"state":{"type":"string","example":"open"},"url":{"type":"string","example":"https://git.code.svchub.com/HumanizeIQ/gais_myapp/pulls/5"},"sourceBranch":{"type":"string","example":"playtest"},"targetBranch":{"type":"string","example":"dev"},"createdAt":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Bad request - missing or invalid parameters","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"targetBranch must be either \"dev\" or \"main\"."}}}}}},"404":{"description":"Component, repository, or branch not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Component not found."}}}}}},"409":{"description":"Pull request already exists or branches are identical","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Pull request already exists or branches are identical."}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to create pull request."}}}}}}}}},"/app-builder/prompts":{"get":{"tags":["App Builder"],"summary":"Get system AI prompts","description":"Retrieves the AI system prompts configuration from the server","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"responses":{"200":{"description":"System prompts retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"documentation_assistant":{"type":"string"},"ideation_product_manager":{"type":"string"},"design_architect":{"type":"string"},"requirements_product_owner":{"type":"string"},"builder_prompt_engineer":{"type":"string"},"requirements_generator_modal":{"type":"string"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to fetch system prompts"}}}}}}}}},"/app-builder/component-prompts":{"get":{"tags":["App Builder"],"summary":"Get component prompts","description":"Retrieves all prompts associated with a specific component","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"componentId","in":"query","required":true,"description":"Component ID","schema":{"type":"integer","example":201}}],"responses":{"200":{"description":"Component prompts retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","example":401},"component_id":{"type":"integer","example":201},"title":{"type":"string","example":"System Prompt"},"description":{"type":"string","example":"Core system instruction"},"type":{"type":"string","enum":["System","Other"],"example":"System"},"content":{"type":"string","example":"You are an AI..."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}},"400":{"description":"Bad request - missing or invalid componentId","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"componentId query parameter is required."}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to fetch component prompts"}}}}}}}},"post":{"tags":["App Builder"],"summary":"Create component prompt","description":"Creates a new prompt for a component","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["componentId","title","type","content"],"properties":{"componentId":{"type":"integer","example":201},"title":{"type":"string","example":"New Prompt"},"description":{"type":"string","example":"Prompt description"},"type":{"type":"string","enum":["System","Other"],"example":"Other"},"content":{"type":"string","example":"You are an AI assistant..."}}}}}},"responses":{"201":{"description":"Prompt created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Prompt created successfully."},"prompt":{"type":"object","properties":{"id":{"type":"integer","example":402},"component_id":{"type":"integer","example":201},"title":{"type":"string","example":"New Prompt"},"description":{"type":"string","example":"Desc"},"type":{"type":"string","example":"Other"},"content":{"type":"string","example":"Content"},"created_at":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Bad request - missing or invalid data","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"title is required."}}}}}},"404":{"description":"Component not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Component not found."}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to create prompt"}}}}}}}},"patch":{"tags":["App Builder"],"summary":"Update component prompt","description":"Updates an existing component prompt","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id"],"properties":{"id":{"type":"integer","example":402},"title":{"type":"string","example":"Updated Title"},"description":{"type":"string","example":"Updated description"},"type":{"type":"string","enum":["System","Other"],"example":"Other"},"content":{"type":"string","example":"Updated content"}}}}}},"responses":{"200":{"description":"Prompt updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Prompt updated successfully."},"prompt":{"type":"object","properties":{"id":{"type":"integer","example":402},"component_id":{"type":"integer","example":201},"title":{"type":"string","example":"Updated Title"},"description":{"type":"string","example":"Desc"},"type":{"type":"string","example":"Other"},"content":{"type":"string","example":"Content"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Bad request - missing or invalid data","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"id is required."}}}}}},"404":{"description":"Prompt not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Prompt not found."}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to update prompt"}}}}}}}},"delete":{"tags":["App Builder"],"summary":"Delete component prompt","description":"Deletes a component prompt","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"id","in":"query","required":true,"description":"Prompt ID","schema":{"type":"integer","example":402}}],"responses":{"200":{"description":"Prompt deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Prompt deleted successfully."}}}}}},"400":{"description":"Bad request - missing or invalid id","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"id query parameter is required."}}}}}},"404":{"description":"Prompt not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Prompt not found."}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to delete prompt"}}}}}}}}},"/app-builder/component-content":{"get":{"tags":["App Builder"],"summary":"Get component content items","description":"Retrieve all content items for a specific component","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"componentId","in":"query","description":"Component ID","required":true,"schema":{"type":"integer","example":201}}],"responses":{"200":{"description":"Content items retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","example":501},"component_id":{"type":"integer","example":201},"text_id":{"type":"string","example":"app_verify_access"},"description":{"type":"string","example":"Loading text..."},"text":{"type":"string","example":"Verifying access..."},"format":{"type":"string","enum":["plain","markdown"],"example":"plain"},"type":{"type":"string","enum":["Title","Body","LinkText","Heading"],"example":"Body"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}},"400":{"description":"Bad request - missing or invalid componentId","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"componentId query parameter is required and must be a valid number."}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to fetch component content"}}}}}}}},"post":{"tags":["App Builder"],"summary":"Create component content item","description":"Create a new content item for a component","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["componentId","textId","text","format","type"],"properties":{"componentId":{"type":"integer","example":201,"description":"Component ID"},"textId":{"type":"string","example":"welcome_msg","description":"Unique identifier for the content item"},"description":{"type":"string","example":"Welcome message","description":"Optional description of the content"},"text":{"type":"string","example":"Hello User!","description":"The actual content text"},"format":{"type":"string","enum":["plain","markdown"],"example":"plain","description":"Content format"},"type":{"type":"string","enum":["Title","Body","LinkText","Heading"],"example":"Body","description":"Content type"}}}}}},"responses":{"201":{"description":"Content item created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Content item created successfully."},"item":{"type":"object","properties":{"id":{"type":"integer","example":502},"component_id":{"type":"integer","example":201},"text_id":{"type":"string","example":"welcome_msg"},"description":{"type":"string","example":"Welcome message"},"text":{"type":"string","example":"Hello User!"},"format":{"type":"string","example":"plain"},"type":{"type":"string","example":"Body"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Bad request - validation error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"textId is required and must be a non-empty string."}}}}}},"404":{"description":"Component not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Component not found."}}}}}},"409":{"description":"Conflict - content item with this textId already exists","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Content item with this text_id already exists for this component"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to create content item"}}}}}}}},"patch":{"tags":["App Builder"],"summary":"Update component content item","description":"Update an existing content item. Only the fields provided in the request body will be updated.","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id"],"properties":{"id":{"type":"integer","example":502,"description":"Content item ID"},"textId":{"type":"string","example":"updated_welcome_msg","description":"Optional - Updated text identifier"},"description":{"type":"string","example":"Updated description","description":"Optional - Updated description"},"text":{"type":"string","example":"Welcome back!","description":"Optional - Updated content text"},"format":{"type":"string","enum":["plain","markdown"],"example":"markdown","description":"Optional - Updated format"},"type":{"type":"string","enum":["Title","Body","LinkText","Heading"],"example":"Title","description":"Optional - Updated type"}}},"examples":{"Update text only":{"value":{"id":502,"text":"Updated welcome message"}},"Update multiple fields":{"value":{"id":502,"text":"Updated text","format":"markdown","type":"Heading"}}}}}},"responses":{"200":{"description":"Content item updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Content item updated successfully."},"item":{"type":"object","properties":{"id":{"type":"integer","example":502},"component_id":{"type":"integer","example":201},"text_id":{"type":"string","example":"welcome_msg"},"description":{"type":"string","example":"Updated description"},"text":{"type":"string","example":"Welcome back!"},"format":{"type":"string","example":"markdown"},"type":{"type":"string","example":"Title"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Bad request - validation error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"No valid fields provided for update. Allowed fields: textId, description, text, format, type"}}}}}},"404":{"description":"Content item not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Content item not found."}}}}}},"409":{"description":"Conflict - content item with this textId already exists","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Content item with this text_id already exists for this component"}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to update content item"},"details":{"type":"string","example":"Database error"}}}}}}}}},"/work-management/tasks":{"get":{"tags":["Work Management"],"summary":"Get tasks for authenticated user","description":"Retrieve all tasks assigned to the authenticated user","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"responses":{"200":{"description":"Tasks retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","example":601},"title":{"type":"string","example":"Complete Design Doc"},"description":{"type":"string","example":"Finalize the architecture diagram."},"assignee":{"type":"string","example":"User Name"},"assigned_date":{"type":"string","format":"date-time","example":"2025-01-01T10:00:00Z"},"due_date":{"type":"string","format":"date-time","example":"2025-01-05T17:00:00Z"},"start_date":{"type":"string","format":"date-time","nullable":true,"example":null},"close_date":{"type":"string","format":"date-time","nullable":true,"example":null},"status":{"type":"string","enum":["Assigned","Open","InProgress","Closed"],"example":"Assigned"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}},"401":{"description":"Unauthorized - user not authenticated","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"User not authenticated."}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to fetch tasks"}}}}}}}},"post":{"tags":["Work Management"],"summary":"Create a new task","description":"Create a new task. The assignedDate is automatically set to the current timestamp.","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["title","assignee","dueDate","organizationId","projectId"],"properties":{"title":{"type":"string","example":"New Task","description":"Task title"},"description":{"type":"string","example":"Task description","description":"Optional task description"},"assignee":{"type":"string","description":"User ID (uid) of the person assigned to this task","example":"426bcea5-adb9-4580-a8ca-3a40fdb0ef85"},"dueDate":{"type":"string","format":"date-time","example":"2025-01-10T17:00:00Z","description":"Task due date (ISO 8601 format)"},"organizationId":{"type":"integer","example":1,"description":"Organization ID"},"projectId":{"type":"integer","example":1,"description":"Project ID"}}}}}},"responses":{"201":{"description":"Task created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Task created successfully."},"task":{"type":"object","properties":{"id":{"type":"integer","example":602},"title":{"type":"string","example":"New Task"},"description":{"type":"string","example":"Desc"},"assignee":{"type":"string","example":"Assignee Name"},"assigned_date":{"type":"string","format":"date-time","example":"2025-01-02T12:00:00Z"},"due_date":{"type":"string","format":"date-time","example":"2025-01-10T17:00:00Z"},"start_date":{"type":"string","nullable":true,"example":null},"close_date":{"type":"string","nullable":true,"example":null},"status":{"type":"string","example":"Open"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Bad request - validation error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"title is required and must be a non-empty string."}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to create task"}}}}}}}}},"/work-management/tasks/{id}/status":{"patch":{"tags":["Work Management"],"summary":"Update task status","description":"Update the status of a task. Backend automatically sets startDate when status changes to InProgress and closeDate when status changes to Closed.","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"id","in":"path","description":"Task ID","required":true,"schema":{"type":"integer","example":601}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["Assigned","Open","InProgress","Closed"],"example":"InProgress","description":"New task status"}}},"examples":{"Start task":{"value":{"status":"InProgress"}},"Close task":{"value":{"status":"Closed"}},"Reopen task":{"value":{"status":"Open"}}}}}},"responses":{"200":{"description":"Task status updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Task status updated."},"task":{"type":"object","properties":{"id":{"type":"integer","example":601},"title":{"type":"string","example":"Complete Design Doc"},"description":{"type":"string","example":"Finalize the architecture diagram."},"assignee":{"type":"string","example":"User Name"},"assigned_date":{"type":"string","format":"date-time"},"due_date":{"type":"string","format":"date-time"},"start_date":{"type":"string","format":"date-time","example":"2025-01-03T09:00:00Z"},"close_date":{"type":"string","nullable":true,"example":null},"status":{"type":"string","example":"InProgress"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}}},"400":{"description":"Bad request - validation error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"status is required and must be one of: Open, InProgress, Closed"}}}}}},"404":{"description":"Task not found","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Task not found."}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Failed to update task status"},"details":{"type":"string","example":"Database error"}}}}}}}}},"/rbac/roles":{"get":{"tags":["RBAC"],"summary":"Get all roles","description":"Retrieve all roles in the system","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"responses":{"200":{"description":"Roles retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"Admin"},"description":{"type":"string","example":"Administrator role"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}}}},"post":{"tags":["RBAC"],"summary":"Create a new role","description":"Create a new role in the system","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","example":"Editor"},"description":{"type":"string","example":"Can edit content"}}}}}},"responses":{"201":{"description":"Role created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Role created successfully."},"role":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"}}}}}}}},"409":{"description":"Role already exists","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"error"},"message":{"type":"string","example":"Role with this name already exists."}}}}}}}}},"/rbac/roles/{roleId}":{"delete":{"tags":["RBAC"],"summary":"Delete a role","description":"Delete a role from the system","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"roleId","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Role deleted successfully"},"404":{"description":"Role not found"}}}},"/rbac/permissions":{"get":{"tags":["RBAC"],"summary":"Get all permissions","description":"Retrieve all permissions in the system","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"responses":{"200":{"description":"Permissions retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","example":1},"name":{"type":"string","example":"create:component"},"description":{"type":"string","example":"Can create components"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}}}}}}}},"post":{"tags":["RBAC"],"summary":"Create a new permission","description":"Create a new permission in the system","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","example":"delete:component"},"description":{"type":"string","example":"Can delete components"}}}}}},"responses":{"201":{"description":"Permission created successfully"},"409":{"description":"Permission already exists"}}}},"/rbac/permissions/{permissionId}":{"delete":{"tags":["RBAC"],"summary":"Delete a permission","description":"Delete a permission from the system","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"permissionId","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Permission deleted successfully"},"404":{"description":"Permission not found"}}}},"/rbac/roles/{roleId}/permissions":{"get":{"tags":["RBAC"],"summary":"Get permissions for a role","description":"Retrieve all permissions assigned to a specific role","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"roleId","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Permissions retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"}}}}}}}}},"post":{"tags":["RBAC"],"summary":"Add permission to role","description":"Assign a permission to a role","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"roleId","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["permissionId"],"properties":{"permissionId":{"type":"integer","example":1}}}}}},"responses":{"200":{"description":"Permission added to role successfully"},"404":{"description":"Role or permission not found"}}}},"/rbac/roles/{roleId}/permissions/{permissionId}":{"delete":{"tags":["RBAC"],"summary":"Remove permission from role","description":"Remove a permission from a role","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"roleId","in":"path","required":true,"schema":{"type":"integer"}},{"name":"permissionId","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Permission removed from role successfully"}}}},"/rbac/users/{userId}/roles":{"get":{"tags":["RBAC"],"summary":"Get user roles","description":"Retrieve all roles assigned to a user","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"userId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"User roles retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"}}}}}}}}},"post":{"tags":["RBAC"],"summary":"Add user to role","description":"Assign a role to a user","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"userId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["roleId"],"properties":{"roleId":{"type":"integer","example":1}}}}}},"responses":{"200":{"description":"User added to role successfully"},"404":{"description":"User or role not found"}}}},"/rbac/users/{userId}/roles/{roleId}":{"delete":{"tags":["RBAC"],"summary":"Remove user from role","description":"Remove a role from a user","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"userId","in":"path","required":true,"schema":{"type":"string"}},{"name":"roleId","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"User removed from role successfully"}}}},"/rbac/users/{userId}/permissions":{"get":{"tags":["RBAC"],"summary":"Get user permissions","description":"Retrieve all unique permissions for a user across all their roles","security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"parameters":[{"name":"userId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"User permissions retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"}}}}}}}}}},"/rbac/me/roles":{"get":{"tags":["RBAC"],"summary":"Get current user roles and permissions","description":"Retrieve role names and permission names for the currently authenticated user (from decrypted cookie)","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Current user roles and permissions retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"roles":{"type":"array","items":{"type":"string"},"example":["Admin","Editor"]},"permissions":{"type":"array","items":{"type":"string"},"example":["create:component","delete:component","edit:component"]}}}}}},"401":{"description":"User not authenticated or using API key"}}}},"/rbac/me/permissions":{"get":{"tags":["RBAC"],"summary":"Get current user permissions","description":"Retrieve all unique permissions for the currently authenticated user across all their roles (from decrypted cookie)","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Current user permissions retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string"}}}}}}},"401":{"description":"User not authenticated or using API key"}}}},"/rbac/me":{"get":{"tags":["RBAC"],"summary":"Get current user complete profile","description":"Retrieve roles, permissions, and preferences for the currently authenticated user","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"User profile retrieved successfully","content":{"application/json":{"schema":{"type":"object","properties":{"roles":{"type":"array","items":{"type":"string"},"example":["Admin","Editor"]},"permissions":{"type":"array","items":{"type":"string"},"example":["create:component","delete:component"]},"preferences":{"type":"array","items":{"type":"object","properties":{"user_id":{"type":"string"},"app_id":{"type":"string"},"object_id":{"type":"string"},"object_type":{"type":"string"}}}}}}}}},"401":{"description":"User not authenticated or using API key"}}}},"/rbac/preferences":{"get":{"tags":["RBAC"],"summary":"Get all user preferences","description":"Retrieve all preferences for the currently authenticated user","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Preferences retrieved successfully"}}},"post":{"tags":["RBAC"],"summary":"Save user preference","description":"Save or update a preference for the currently authenticated user","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["appId"],"properties":{"appId":{"type":"string","example":"my-app"},"objectId":{"type":"string","example":"obj-123"},"objectType":{"type":"string","example":"dashboard"}}}}}},"responses":{"200":{"description":"Preference saved successfully"}}}},"/rbac/preferences/{appId}":{"get":{"tags":["RBAC"],"summary":"Get preference for specific app","description":"Retrieve preference for a specific app for the currently authenticated user","security":[{"BearerAuth":[]}],"parameters":[{"name":"appId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Preference retrieved successfully"},"404":{"description":"Preference not found"}}}}}}