{
  "type": "object",
  "properties": {
    "encryptionKey": {
      "type": "string",
      "format": "uuid",
      "description": "Optional encryption key (UUID) for updating existing credentials.\n\n**First call (omit this field):**\n- A new UUID will be generated\n- Credentials will be encrypted with this UUID\n- The UUID will be returned in the response\n- **Store this UUID securely** - it's required for all future API calls\n\n**Subsequent calls (include this field):**\n- Provide the UUID returned from the initial save call\n- Existing credentials will be decrypted, updated, and re-encrypted\n- The same UUID will be returned in the response\n\n**Important:** The returned encryption key must be sent in the `API-KEY` header for all AI and image processing API requests.",
      "example": "a2d950aa-2468-46bb-b443-1a405a184ee0"
    },
    "ai": {
      "type": "object",
      "description": "AI service credentials (Google Gemini and Discord Midjourney)",
      "properties": {
        "googleApiKey": {
          "type": "string",
          "description": "Google Gemini API key",
          "example": "BUzaSyAQRUKhgTH6hPsiMzPXhF1jbkgVlHd1gso"
        },
        "discordSalaiToken": {
          "type": "string",
          "description": "Discord Salai token for Midjourney",
          "example": "NYU2OTkzMjEwMzIyNDQxNDIyMQ.GZja9d.JZ4RWfCP6d5gKIzVFB2XrvDuzdgwrhYbtSqWED"
        },
        "discordServerId": {
          "type": "string",
          "description": "Discord server ID",
          "example": "1239875983914864641"
        },
        "discordChannelId": {
          "type": "string",
          "description": "Discord channel ID",
          "example": "1239875965768964644"
        }
      },
      "required": ["googleApiKey", "discordSalaiToken", "discordServerId", "discordChannelId"]
    },
    "colorConversion": {
      "type": "object",
      "description": "Color conversion service credentials for vectorization API",
      "properties": {
        "apiUrl": {
          "type": "string",
          "format": "uri",
          "description": "Color conversion API base URL (e.g., https://api.colorconvert.com/v1). This should be the base URL without the endpoint path.",
          "example": "https://api.colorconvert.com/v1"
        },
        "xCreditCode": {
          "type": "string",
          "description": "X-CREDITS-CODE authentication token. This is used as the Authorization header value when calling the vectorization API.",
          "example": "Bearer your-credit-code-here"
        },
        "mode": {
          "type": "string",
          "description": "Processing mode for color conversion. Must be either 'production' or 'test'.",
          "enum": ["production", "test"],
          "example": "production"
        },
        "maxColors": {
          "type": "integer",
          "minimum": 1,
          "maximum": 255,
          "description": "Maximum number of colors that the color conversion API should consider (1-255).",
          "example": 16
        }
      },
      "required": ["apiUrl", "xCreditCode", "mode", "maxColors"]
    },
    "removeBackground": {
      "type": "object",
      "description": "Remove background service credentials",
      "properties": {
        "apiUrl": {
          "type": "string",
          "format": "uri",
          "description": "Remove background API URL",
          "example": "https://api.removebg.com/v1"
        },
        "secretKey": {
          "type": "string",
          "description": "Secret API key for authentication",
          "example": "your-secret-key-here"
        }
      },
      "required": ["apiUrl", "secretKey"]
    }
  },
  "description": "At least one credential type (ai, colorConversion, removeBackground) must be provided with all required fields."
}
