{
  "openapi": "3.0.1",
  "info": {
    "title": "BYI Node service",
    "description": "API Documentation for BYI Node service.",
    "version": "1.0.0"
  },
  "tags": [
    {
      "name": "Import",
      "description": "Import service related API."
    },
    {
      "name": "Output",
      "description": "Output service related API."
    },
    {
      "name": "AI",
      "description": "AI service related API."
    },
    {
      "name": "Customizer",
      "description": "Customizer service related API."
    },
    {
      "name": "Gangsheet",
      "description": "Gangsheet service related API."
    },
    {
      "name": "Image Processing",
      "description": "Image processing service related API."
    },
    {
      "name": "Credentials",
      "description": "Credential management API."
    },
    {
      "name": "Logs",
      "description": "Logs service related API."
    }
  ],
  "produces": ["application/json"],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "name": "API-KEY",
        "in": "header",
        "description": "The encryption key (UUID) returned from `/api/save-credentials`. This key is used to decrypt and access the stored credentials for AI and image processing operations."
      }
    },
    "schemas": {
      "SaveCredentialRequest": {
        "type": "object",
        "properties": {
          "encryptionKey": {
            "type": "string",
            "format": "uuid",
            "description": "Optional encryption key (UUID) for updating existing credentials.\n\n- **Omit for first call:** A new UUID will be generated, used to encrypt credentials, and returned in the response. Store this key securely.\n- **Include for updates:** Provide the encryption key returned from the initial save call. This key is used to decrypt, update, and re-encrypt the credentials.\n\nThe same 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."
      }
    }
  },
  "paths": {
    "/api/save-credentials": {
      "post": {
        "tags": ["Credentials"],
        "summary": "Save or update credentials",
        "description": "Save or update encrypted credentials for AI, Color Conversion, or Remove Background services.\n\n**Flow:**\n1. **First call (no encryptionKey):**\n   - Generate a new UUID encryption key\n   - Encrypt credentials with this UUID\n   - Save encrypted credentials to file\n   - Return the encryption key (UUID) in response\n   - **Store this key securely** - it's required for all future API calls\n\n2. **Subsequent calls (with encryptionKey):**\n   - Use the provided encryption key to decrypt existing credentials\n   - Merge new data with existing data (only provided fields are updated)\n   - Re-encrypt with the same key\n   - Save updated credentials\n   - Return the same encryption key\n\n**Usage:**\n- The returned encryption key must be sent in the `API-KEY` header for all AI and image processing API requests\n- Each credential set is encrypted with its own unique encryption key (UUID)\n- You can save multiple credential types (ai, colorConversion, removeBackground) in a single call\n- At least one credential type must be provided\n\n**Security:**\n- Credentials are encrypted using AES-256-CBC\n- The encryption key (UUID) is used to derive the encryption key\n- Credentials are stored in an encrypted file on the server\n- Rate limiting is applied to prevent abuse",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SaveCredentialRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "summary": "Credentials created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Credentials saved successfully"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "encryptionKey": {
                          "type": "string",
                          "format": "uuid",
                          "description": "Encryption key for future updates. Store this securely.",
                          "example": "a2d950aa-2468-46bb-b443-1a405a184ee0"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "200": {
            "summary": "Credentials updated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Credentials updated successfully"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "encryptionKey": {
                          "type": "string",
                          "format": "uuid",
                          "example": "a2d950aa-2468-46bb-b443-1a405a184ee0"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "304": {
            "summary": "No changes made.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Credentials are already in use and no changes were made"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "encryptionKey": {
                          "type": "string",
                          "format": "uuid",
                          "example": "a2d950aa-2468-46bb-b443-1a405a184ee0"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - Invalid parameters or missing required fields.",
            "summary": "Bad Request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "examples": [
                        "At least one credential type (ai, colorConversion, removeBackground) must be provided with data",
                        "Invalid encryption key format. Expected UUID format."
                      ]
                    }
                  }
                }
              }
            }
          },
          "429": {
            "summary": "Too Many Requests.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Too many requests from this IP, please try again later"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred while processing the request.",
            "summary": "Internal Server Error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Internal Server Error"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/ai/generate-quotes": {
      "post": {
        "tags": ["AI"],
        "summary": "Generate quotes from topic",
        "description": "Generate quotes using Google Gemini AI. Requires the encryption key (UUID) returned from `/api/save-credentials` in the `API-KEY` header.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "topic": {
                    "type": "string",
                    "example": "Happy Birthday"
                  },
                  "minimum_lines": {
                    "type": "integer",
                    "example": 0
                  },
                  "maximum_lines": {
                    "type": "integer",
                    "example": 0
                  },
                  "per_line_minimum_character": {
                    "type": "integer",
                    "example": 0
                  },
                  "per_line_maximum_character": {
                    "type": "integer",
                    "example": 0
                  }
                },
                "required": ["topic"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "summary": "Successful Operation.",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Quotes generated successfully"
                    },
                    "data": {
                      "type": "string",
                      "example": "Since the format is undefined, I'll generate 10 relatively short and varied Happy Birthday quotes.  There's no constraint on length:\n\n1. Happy Birthday!\n2. Wishing you joy today.\n3. Happy Birthday, friend!\n4. Celebrate your special day!\n5. Have a fantastic birthday!\n6. Many happy returns!\n7. Cheers to another year!\n8. Wishing you all the best!\n9. Enjoy your birthday party!\n10. Happy Birthday to you!\n"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/ai/v2/generate-quotes": {
      "post": {
        "tags": ["AI"],
        "summary": "Generate quotes from topic (V2 - Enhanced)",
        "description": "Enhanced version of quote generation with improved formatting and tag generation. Requires the encryption key (UUID) returned from `/api/save-credentials` in the `API-KEY` header.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "topic": {
                    "type": "string",
                    "example": "Happy Birthday"
                  },
                  "minimum_lines": {
                    "type": "integer",
                    "example": 0
                  },
                  "maximum_lines": {
                    "type": "integer",
                    "example": 0
                  },
                  "per_line_minimum_character": {
                    "type": "integer",
                    "example": 0
                  },
                  "per_line_maximum_character": {
                    "type": "integer",
                    "example": 0
                  }
                },
                "required": ["topic"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "summary": "Successful Operation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Quotes generated successfully"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "generatedQuotes": {
                          "type": "array",
                          "items": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "example": [
                            ["WORK", "HARD"],
                            ["DREAM", "BIG"],
                            ["STAY", "STRONG"]
                          ]
                        },
                        "tagName": {
                          "type": "string",
                          "example": "```json\n[\"INSPIRE\", \"CREATE\", \"GROW\"]\n```"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - Invalid parameters or missing required fields.",
            "summary": "Bad Request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Bad Request."
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Missing or invalid encryption key in API-KEY header.",
            "summary": "Unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "API Key missing or invalid"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred while processing the request.",
            "summary": "Internal Server Error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Internal server error"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/ai/generate-image": {
      "post": {
        "tags": ["AI"],
        "summary": "Generate images from prompt",
        "description": "Generate images using Midjourney AI. Requires the encryption key (UUID) returned from `/api/save-credentials` in the `API-KEY` header.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string",
                    "example": "Love Birds"
                  }
                },
                "required": ["prompt"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "summary": "Successful Operation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Image generated successfully"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "1324020324693708811"
                        },
                        "flags": {
                          "type": "integer",
                          "example": 0
                        },
                        "content": {
                          "type": "string",
                          "example": "**Love Birds --v 5.2** - <@1169932103224414221> (fast)\n-# Create, explore, and organize on [midjourney.com](<https://midjourney.com/imagine?from_discord=1>)"
                        },
                        "hash": {
                          "type": "string",
                          "example": "36f21bf5-439f-402f-9ec5-597472ef9747"
                        },
                        "progress": {
                          "type": "string",
                          "example": "done"
                        },
                        "uri": {
                          "type": "string",
                          "example": "https://cdn.discordapp.com/attachments/1239875983968964644/1324020324454629497/byi_ai_Love_Birds_36f21bf5-439f-402f-9ec5-597472ef9747.png?ex=6776a184&is=67755004&hm=634b21620531d61b9b479b02d8697648fee0c8a22abaacee3d54bbff4df034a0&"
                        },
                        "proxy_url": {
                          "type": "string",
                          "example": "https://media.discordapp.net/attachments/1239875983968964644/1324020324454629497/byi_ai_Love_Birds_36f21bf5-439f-402f-9ec5-597472ef9747.png?ex=6776a184&is=67755004&hm=634b21620531d61b9b479b02d8697648fee0c8a22abaacee3d54bbff4df034a0&"
                        },
                        "options": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "integer",
                                "example": 2
                              },
                              "style": {
                                "type": "integer",
                                "example": 2
                              },
                              "label": {
                                "type": "string",
                                "example": "U1"
                              },
                              "custom": {
                                "type": "string",
                                "example": "MJ::JOB::upsample::1::36f21bf5-439f-402f-9ec5-597472ef9747"
                              }
                            }
                          }
                        },
                        "width": {
                          "type": "integer",
                          "example": 2048
                        },
                        "height": {
                          "type": "integer",
                          "example": 2048
                        },
                        "tag_name": {
                          "type": "string",
                          "example": "```json\n[\"LOVE\", \"BIRDS\", \"ROMANCE\"]\n```"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/ai/generate-single-image": {
      "post": {
        "tags": ["AI"],
        "summary": "Generate single upscaled image",
        "description": "Generate a single upscaled image from Midjourney. Requires the encryption key (UUID) returned from `/api/save-credentials` in the `API-KEY` header.",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "msgId": {
                    "type": "string",
                    "example": "1324022416187457658"
                  },
                  "flags": {
                    "type": "integer",
                    "example": 0
                  },
                  "customId": {
                    "type": "string",
                    "example": "MJ::JOB::upsample::1::8ed00eb2-d756-472f-84aa-4c20b0b72fd6"
                  }
                },
                "required": ["msgId", "flags", "customId"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "summary": "Successful Operation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Single Image generated successfully"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "1324022463457263667"
                        },
                        "flags": {
                          "type": "integer",
                          "example": 0
                        },
                        "content": {
                          "type": "string",
                          "example": "**Love Birds --v 5.2** - Image #1 <@1169932103224414221>"
                        },
                        "hash": {
                          "type": "string",
                          "example": "e005e038-2413-4b41-84ef-4a8d7d765852"
                        },
                        "progress": {
                          "type": "string",
                          "example": "done"
                        },
                        "uri": {
                          "type": "string",
                          "example": "https://cdn.discordapp.com/attachments/1239875983968964644/1324022463507726346/byi_ai_Love_Birds_e005e038-2413-4b41-84ef-4a8d7d765852.png?ex=6776a382&is=67755202&hm=9c2e92414bf0133ccfdb00f1ba347ba1296bc73ef9109f59fc58b9d56e344b96&"
                        },
                        "proxy_url": {
                          "type": "string",
                          "example": "https://media.discordapp.net/attachments/1239875983968964644/1324022463507726346/byi_ai_Love_Birds_e005e038-2413-4b41-84ef-4a8d7d765852.png?ex=6776a382&is=67755202&hm=9c2e92414bf0133ccfdb00f1ba347ba1296bc73ef9109f59fc58b9d56e344b96&"
                        },
                        "options": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "integer",
                                "example": 2
                              },
                              "style": {
                                "type": "integer",
                                "example": 2
                              },
                              "label": {
                                "type": "string",
                                "example": "Upscale (2x)"
                              },
                              "custom": {
                                "type": "string",
                                "example": "MJ::JOB::upsample_v5_2x::1::e005e038-2413-4b41-84ef-4a8d7d765852::SOLO"
                              }
                            }
                          }
                        },
                        "width": {
                          "type": "integer",
                          "example": 1024
                        },
                        "height": {
                          "type": "integer",
                          "example": 1024
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/gangsheet/generate": {
      "post": {
        "tags": ["Gangsheet"],
        "summary": "Generate gangsheet output",
        "description": "Generates gangsheet output for a design order. This is an asynchronous operation that processes in the background.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "designOrderId": {
                    "type": "integer",
                    "description": "Design order ID",
                    "example": 12345
                  },
                  "baseUrl": {
                    "type": "string",
                    "description": "Base URL for the application",
                    "pattern": "^https?://.*",
                    "example": "http://localhost.magento-task.com"
                  },
                  "designData": {
                    "type": "string",
                    "description": "Optional design data as JSON string",
                    "example": "{\"designId\": 28, \"orderId\": 14}"
                  }
                },
                "required": ["designOrderId", "baseUrl"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "summary": "Successful Operation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Gangsheet Output generation in process for Design order ID : 12345"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - Invalid parameters or missing required fields.",
            "summary": "Bad Request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Bad Request."
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred while processing the request.",
            "summary": "Internal Server Error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Internal Server Error."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/image-processing/get-image-color": {
      "post": {
        "tags": ["Image Processing"],
        "summary": "Get image color conversion",
        "description": "Converts an image to SVG format with specified color count or black/white conversion. This endpoint uses external APIs or Python scripts to process the image.\n\n**Authentication:**\n- Requires `API-KEY` header with the encryption key (UUID) returned from `/api/save-credentials`\n- The encryption key must have `colorConversion` credentials configured\n\n**Color Conversion Types:**\n- **Number (1-256):** Converts image to SVG with specified number of colors using external vectorization API\n- **'black_white':** Converts image to black and white using Python script, generates both SVG and PNG formats\n\n**File Structure:**\n- Converted images are saved to: `{mediaPath}/{original_dir}/{original_filename}/converted/{filename}_pd_{no_of_image_convert}_color.svg`\n- If the file already exists, it returns the cached version without reprocessing",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "image_url": {
                    "type": "string",
                    "format": "uri",
                    "description": "Full URL of the image to convert. Must contain '/media/' in the path.",
                    "example": "https://example.com/media/productdesigner/imagecolor/sample.jpg"
                  },
                  "image_convert_type": {
                    "type": "string",
                    "enum": ["color"],
                    "description": "Type of image conversion. Currently only 'color' is supported.",
                    "example": "color"
                  },
                  "no_of_image_convert": {
                    "oneOf": [
                      {
                        "type": "string",
                        "enum": ["black_white"],
                        "description": "Convert to black and white. Generates both SVG and PNG formats."
                      },
                      {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 256,
                        "description": "Number of colors for conversion (1-256). Uses external vectorization API."
                      }
                    ],
                    "description": "Color conversion specification. Either 'black_white' for black/white conversion or a number (1-256) for color count.",
                    "example": 16
                  }
                },
                "required": ["image_url", "image_convert_type", "no_of_image_convert"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Image converted successfully.",
            "summary": "Image converted successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Successfully Generated image"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": ["Success"],
                          "example": "Success"
                        },
                        "message": {
                          "type": "string",
                          "example": "Successfully Generated image"
                        },
                        "result": {
                          "type": "string",
                          "description": "JSON string containing the result data",
                          "example": "{\"original_image_url\":\"https://example.com/media/image.jpg\",\"generated_image_url\":\"https://example.com/media/image/converted/image_pd_16_color.svg\"}"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - Invalid parameters or missing required fields.",
            "summary": "Bad Request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "examples": ["Please send proper params.", "Invalid image URL format - must contain /media/"]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": ["Error"],
                          "example": "Error"
                        },
                        "message": {
                          "type": "string",
                          "example": "Please send proper params."
                        },
                        "result": {
                          "type": "string",
                          "example": ""
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Missing or invalid encryption key in API-KEY header.",
            "summary": "Unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "examples": [
                        "Encryption key missing. Please provide encryption key in API-KEY header.",
                        "Invalid encryption key format. Expected UUID format.",
                        "Failed to decrypt credentials. Invalid encryption key or corrupted credential file.",
                        "Credential not found. Please ensure credentials are saved and the correct encryption key is provided.",
                        "Color conversion credentials not configured for this encryption key. Please save color conversion credentials first."
                      ]
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred while processing the request.",
            "summary": "Internal Server Error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Failed to generate image"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": ["Error"],
                          "example": "Error"
                        },
                        "message": {
                          "type": "string",
                          "example": "Failed to generate image"
                        },
                        "result": {
                          "type": "string",
                          "example": ""
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/image-processing/save-svg": {
      "post": {
        "tags": ["Image Processing"],
        "summary": "Save color detection SVG",
        "description": "Saves a color detection SVG file to the media directory. The SVG is processed to convert external image URLs to base64-encoded data URIs for security and portability.\n\n**Authentication:**\n- Requires `API-KEY` header with the encryption key (UUID) returned from `/api/save-credentials`\n- The encryption key is used to verify access but does not require specific credential types\n\n**Processing:**\n- Decodes base64-encoded SVG from request body\n- Scans SVG for external image URLs (http/https)\n- Downloads and converts external images to base64 data URIs\n- Saves processed SVG to media directory with unique filename\n\n**File Structure:**\n- SVG files are saved to: `{mediaPath}/{url_dir}/{unique_timestamp}.svg`\n- Filename format: `{timestamp}_{random}.svg`",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "canvasSVG": {
                    "type": "string",
                    "format": "byte",
                    "description": "Base64-encoded SVG content. The SVG will be decoded and processed before saving.",
                    "example": "PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIi8+PC9zdmc+"
                  },
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "description": "Reference URL used to determine the save location. Must contain '/media' in the path. The directory structure from this URL will be used for saving the SVG.",
                    "example": "https://example.com/media/productdesigner/imagecolor/reference.jpg"
                  }
                },
                "required": ["canvasSVG", "url"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "SVG saved successfully.",
            "summary": "SVG saved successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Successfully Generated image"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": ["Success"],
                          "example": "Success"
                        },
                        "message": {
                          "type": "string",
                          "example": "Successfully Generated image"
                        },
                        "result": {
                          "type": "string",
                          "description": "JSON string containing the saved SVG URL",
                          "example": "{\"data\":\"https://example.com/media/productdesigner/imagecolor/1703520000_123.svg\"}"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - Invalid parameters or missing required fields.",
            "summary": "Bad Request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "examples": ["Please send proper params.", "Invalid base64 SVG data", "Invalid URL format"]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": ["Error"],
                          "example": "Error"
                        },
                        "message": {
                          "type": "string",
                          "example": "Please send proper params."
                        },
                        "result": {
                          "type": "string",
                          "example": ""
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Missing or invalid encryption key in API-KEY header.",
            "summary": "Unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "examples": [
                        "Encryption key missing. Please provide encryption key in API-KEY header.",
                        "Invalid encryption key format. Expected UUID format.",
                        "Failed to decrypt credentials. Invalid encryption key or corrupted credential file.",
                        "Credential not found. Please ensure credentials are saved and the correct encryption key is provided."
                      ]
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred while processing the request.",
            "summary": "Internal Server Error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Failed to save SVG"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": ["Error"],
                          "example": "Error"
                        },
                        "message": {
                          "type": "string",
                          "example": "Failed to save SVG"
                        },
                        "result": {
                          "type": "string",
                          "example": ""
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/image-processing/remove-background": {
      "post": {
        "tags": ["Image Processing"],
        "summary": "Remove background from image",
        "description": "Removes the background from an image using a third-party API service. The processed image is saved to the media directory following the PHP structure.\n\n**Authentication:**\n- Requires `API-KEY` header with the encryption key (UUID) returned from `/api/save-credentials`\n- The encryption key must have `removeBackground` credentials configured\n\n**File Structure:**\n- Processed images are saved to: `{mediaPath}/{original_dir}/{original_filename}/converted/{original_filename}_pdrembg.png`",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "image_url": {
                    "type": "string",
                    "format": "uri",
                    "description": "URL of the image to process",
                    "example": "https://example.com/image.jpg"
                  },
                  "image_convert_type": {
                    "type": "string",
                    "description": "Optional image conversion type",
                    "example": "png"
                  }
                },
                "required": ["image_url"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Background removed successfully.",
            "summary": "Successful Operation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Background removed successfully"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": ["Success"],
                          "example": "Success"
                        },
                        "message": {
                          "type": "string",
                          "example": "Background removed successfully"
                        },
                        "result": {
                          "type": "object",
                          "properties": {
                            "file": {
                              "type": "string",
                              "description": "Relative path to the processed image from media root",
                              "example": "productdesigner/imagecolor/sample/converted/sample_pdrembg.png"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - Invalid parameters or missing required fields.",
            "summary": "Bad Request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Invalid image URL or missing required fields"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Missing or invalid encryption key in API-KEY header, or remove background credentials not configured.",
            "summary": "Unauthorized.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "examples": [
                        "Encryption key missing. Please provide encryption key in API-KEY header.",
                        "Invalid encryption key format. Expected UUID format.",
                        "Failed to decrypt credentials. Invalid encryption key or corrupted credential file.",
                        "Credential not found. Please ensure credentials are saved and the correct encryption key is provided.",
                        "Remove background credentials not configured for this encryption key. Please save remove background credentials first."
                      ]
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred while processing the request.",
            "summary": "Internal Server Error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Failed to process image"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/customizer/getPartsFromAssets": {
      "post": {
        "tags": ["Customizer"],
        "summary": "Retrieve parts from GLB and SVG files.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "glb": {
                    "type": "string",
                    "format": "uri",
                    "pattern": ".*\\.(glb|gltf)$",
                    "example": "https://example.com/model.glb"
                  },
                  "svg": {
                    "type": "string",
                    "format": "uri",
                    "pattern": ".*\\.svg$",
                    "example": "https://example.com/design.svg"
                  }
                },
                "required": ["glb", "svg"]
              }
            },
            "required": ["assets"]
          }
        },
        "responses": {
          "200": {
            "summary": "Successful Operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Completed Successfully"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "glbParts": {
                          "type": "object",
                          "example": {
                            "Body": ["Mesh1", "Mesh2"],
                            "Wheels": ["Wheel1", "Wheel2"]
                          }
                        },
                        "svgParts": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "example": ["Layer1", "Layer2", "Layer3"]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "summary": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "GLB and SVG URLs are required."
                    }
                  }
                }
              }
            }
          },
          "500": {
            "summary": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "An unexpected error occurred while processing."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/logs/viewer": {
      "get": {
        "tags": ["Logs"],
        "summary": "Get log viewer HTML page",
        "description": "Returns an HTML page for viewing logs with filtering and search capabilities.",
        "responses": {
          "200": {
            "summary": "HTML page",
            "content": {
              "text/html": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/api/logs/files": {
      "get": {
        "tags": ["Logs"],
        "summary": "Get list of log files",
        "description": "Returns a list of all available log files with their metadata, organized by category (Application, Errors, HTTP Access, Modules).",
        "responses": {
          "200": {
            "summary": "Successful Operation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Log files retrieved successfully"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "example": "app-2025-12-24.log"
                          },
                          "fullPath": {
                            "type": "string",
                            "example": "/var/www/html/w2p-printerp-pod/var/log/node/application/app-2025-12-24.log"
                          },
                          "relativePath": {
                            "type": "string",
                            "example": "application/app-2025-12-24.log"
                          },
                          "size": {
                            "type": "integer",
                            "example": 1024000
                          },
                          "modified": {
                            "type": "string",
                            "format": "date-time",
                            "example": "2025-12-24T10:30:00.000Z"
                          },
                          "category": {
                            "type": "string",
                            "enum": ["Application", "Errors", "HTTP Access", "Modules", "Root"],
                            "example": "Application"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred while processing the request.",
            "summary": "Internal Server Error.",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Failed to read log directory"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/logs/stats": {
      "get": {
        "tags": ["Logs"],
        "summary": "Get log statistics",
        "description": "Returns statistics about log files grouped by category, including count and total size.",
        "responses": {
          "200": {
            "summary": "Successful Operation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Log statistics retrieved successfully"
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "object",
                        "properties": {
                          "count": {
                            "type": "integer",
                            "example": 15
                          },
                          "totalSize": {
                            "type": "integer",
                            "example": 52428800
                          }
                        }
                      },
                      "example": {
                        "Application": {
                          "count": 5,
                          "totalSize": 10485760
                        },
                        "Errors": {
                          "count": 3,
                          "totalSize": 2097152
                        },
                        "HTTP Access": {
                          "count": 7,
                          "totalSize": 39845888
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred while processing the request.",
            "summary": "Internal Server Error.",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Failed to get log statistics"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/logs/file/{filename}": {
      "get": {
        "tags": ["Logs"],
        "summary": "Get log file entries with advanced filtering",
        "description": "Returns paginated log entries from a specific log file with comprehensive filtering options including level, date range, module, correlation ID, HTTP filters, and error filters.",
        "parameters": [
          {
            "name": "filename",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Log file name or relative path (e.g., 'app-2025-12-24.log' or 'application/app-2025-12-24.log')",
            "example": "application/app-2025-12-24.log"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1
            },
            "description": "Page number for pagination"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100,
              "minimum": 1,
              "maximum": 500
            },
            "description": "Number of entries per page"
          },
          {
            "name": "level",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["error", "warn", "info", "debug"]
            },
            "description": "Filter by log level"
          },
          {
            "name": "startDate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Start date for filtering logs (ISO 8601 format)"
          },
          {
            "name": "endDate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "End date for filtering logs (ISO 8601 format)"
          },
          {
            "name": "module",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["ai", "customizer", "dieline", "gangsheet", "import", "output", "image-processing"]
            },
            "description": "Filter by module name"
          },
          {
            "name": "correlationId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by correlation ID (partial match supported)"
          },
          {
            "name": "statusCode",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by HTTP status code (e.g., '200', '404', '500')"
          },
          {
            "name": "method",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"]
            },
            "description": "Filter by HTTP method"
          },
          {
            "name": "minResponseTime",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            },
            "description": "Filter by minimum response time in milliseconds (e.g., 1000 for requests > 1s)"
          },
          {
            "name": "logType",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["http-access", "module", "api"]
            },
            "description": "Filter by log type"
          },
          {
            "name": "service",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter by service name"
          },
          {
            "name": "errorName",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["TypeError", "ReferenceError", "SyntaxError", "RangeError", "Error"]
            },
            "description": "Filter by error type/name"
          }
        ],
        "responses": {
          "200": {
            "summary": "Successful Operation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Log file retrieved successfully"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "entries": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "lineNumber": {
                                "type": "integer",
                                "example": 1
                              },
                              "data": {
                                "type": "object",
                                "description": "Log entry data with structured fields",
                                "properties": {
                                  "level": {
                                    "type": "string",
                                    "example": "info"
                                  },
                                  "message": {
                                    "type": "string",
                                    "example": "HTTP Response"
                                  },
                                  "timestamp": {
                                    "type": "string",
                                    "format": "date-time",
                                    "example": "2025-12-24 18:45:45.771"
                                  },
                                  "correlationId": {
                                    "type": "string",
                                    "example": "9ad4cc26-70fb-4c47-b79d-95ae1d8948ad"
                                  },
                                  "module": {
                                    "type": "string",
                                    "example": "http-access"
                                  },
                                  "type": {
                                    "type": "string",
                                    "example": "http-access"
                                  },
                                  "service": {
                                    "type": "string",
                                    "example": "node-services"
                                  },
                                  "method": {
                                    "type": "string",
                                    "example": "GET"
                                  },
                                  "statusCode": {
                                    "type": "integer",
                                    "example": 304
                                  },
                                  "responseTime": {
                                    "type": "integer",
                                    "example": 9
                                  },
                                  "duration": {
                                    "type": "string",
                                    "example": "9ms"
                                  },
                                  "url": {
                                    "type": "string",
                                    "example": "/api/logs/file/app-2025-12-24.log"
                                  }
                                }
                              },
                              "raw": {
                                "type": "string",
                                "example": "{\"level\":\"info\",\"message\":\"HTTP Response\",\"timestamp\":\"2025-12-24 18:45:45.771\",\"correlationId\":\"9ad4cc26-70fb-4c47-b79d-95ae1d8948ad\"}"
                              }
                            }
                          }
                        },
                        "total": {
                          "type": "integer",
                          "example": 150
                        },
                        "page": {
                          "type": "integer",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "example": 100
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - Invalid parameters or missing required fields.",
            "summary": "Bad Request.",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Invalid log file"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "summary": "Not Found.",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Log file not found"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred while processing the request.",
            "summary": "Internal Server Error.",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Failed to read log file"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/logs/search/{filename}": {
      "get": {
        "tags": ["Logs"],
        "summary": "Search logs by query string",
        "description": "Searches for log entries containing the specified query string within a log file. Supports case-insensitive full-text search.",
        "parameters": [
          {
            "name": "filename",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Log file name or relative path (e.g., 'app-2025-12-24.log' or 'application/app-2025-12-24.log')",
            "example": "application/app-2025-12-24.log"
          },
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Search query string (case-insensitive)"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100,
              "minimum": 1,
              "maximum": 500
            },
            "description": "Maximum number of results to return"
          }
        ],
        "responses": {
          "200": {
            "summary": "Successful Operation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Logs searched successfully"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "lineNumber": {
                            "type": "integer",
                            "example": 1
                          },
                          "data": {
                            "type": "object",
                            "description": "Log entry data matching the search query"
                          },
                          "raw": {
                            "type": "string",
                            "example": "{\"level\":\"info\",\"message\":\"Server started\",\"timestamp\":\"2025-01-20T10:30:00.000Z\"}"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - Invalid parameters or missing required fields.",
            "summary": "Bad Request.",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Search query is required"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "summary": "Not Found.",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Log file not found"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - An unexpected error occurred while processing the request.",
            "summary": "Internal Server Error.",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Failed to search logs"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/import/artwork": {
      "post": {
        "tags": ["Import"],
        "summary": "Import Artwork",
        "description": "Imports artwork from the system. This endpoint allows you to import artwork files with associated metadata such as name, price, and artwork path.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "baseUrl": {
                    "type": "string",
                    "description": "Base URL of the application",
                    "example": "http://localhost.magento-task.com"
                  },
                  "artworkId": {
                    "type": "string",
                    "description": "ID of the artwork to import",
                    "example": "1"
                  },
                  "name": {
                    "type": "string",
                    "description": "Name of the artwork",
                    "example": "Sports-1"
                  },
                  "price": {
                    "type": "string",
                    "description": "Price of the artwork",
                    "example": "10"
                  },
                  "artwork_path": {
                    "type": "string",
                    "description": "Path to the artwork file",
                    "example": ""
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Operation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Completed Successfully."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Bad Request."
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not Found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Not Found."
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Internal Server Error."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/import/template": {
      "post": {
        "tags": ["Import"],
        "summary": "Import Template",
        "description": "Imports a template with associated artwork. This endpoint allows you to import template files with metadata including artwork details, dimensions, and associated product information.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "baseUrl": {
                    "type": "string",
                    "description": "Base URL of the application",
                    "example": "http://localhost.magento-task.com"
                  },
                  "templateId": {
                    "type": "string",
                    "description": "ID of the template to import",
                    "example": "1"
                  },
                  "artworkId": {
                    "type": "string",
                    "description": "ID of the associated artwork",
                    "example": "1"
                  },
                  "artworkTitle": {
                    "type": "string",
                    "description": "Title of the artwork",
                    "example": "Sports-1"
                  },
                  "price": {
                    "type": "string",
                    "description": "Price of the template",
                    "example": "10"
                  },
                  "associatedProductId": {
                    "type": "string",
                    "description": "ID of the associated product",
                    "example": "29"
                  },
                  "type": {
                    "type": "string",
                    "description": "Type of import",
                    "example": "import"
                  },
                  "artworks_data": {
                    "type": "object",
                    "description": "Additional artwork data",
                    "example": {}
                  },
                  "dimensions": {
                    "type": "array",
                    "description": "Array of dimensions",
                    "example": []
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Operation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Completed Successfully."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Bad Request."
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not Found.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Not Found."
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Internal Server Error."
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/output/generate": {
      "post": {
        "tags": ["Output"],
        "summary": "Generate Output",
        "description": "Generates output files for a design order. This endpoint processes design data and generates output files in various formats (JPG, PNG, SVG, Vector PDF, AI, EPS) based on the provided configuration.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "designOrderId": {
                    "type": "number",
                    "description": "ID of the design order",
                    "example": 12345
                  },
                  "baseUrl": {
                    "type": "string",
                    "description": "Base URL of the application",
                    "example": "http://localhost.magento-task.com"
                  },
                  "designData": {
                    "type": "object",
                    "description": "Design data containing output configuration",
                    "properties": {
                      "designOrderId": {
                        "type": "number",
                        "example": 1
                      },
                      "output_files": {
                        "type": "array",
                        "description": "Array of output file formats to generate",
                        "items": {
                          "type": "string",
                          "enum": ["JPG", "PNG", "SVG", "Vector PDF", "AI", "EPS"]
                        },
                        "example": ["JPG", "PNG", "SVG"]
                      },
                      "bleedLines": {
                        "type": "number",
                        "description": "Bleed lines value",
                        "example": 0
                      },
                      "order_id": {
                        "type": "number",
                        "description": "Order ID",
                        "example": 14
                      },
                      "designId": {
                        "type": "number",
                        "description": "Design ID",
                        "example": 28
                      },
                      "output_type": {
                        "type": "string",
                        "description": "Type of output",
                        "enum": ["null", "coffee", "layflat"],
                        "example": "null"
                      },
                      "layoutSize": {
                        "type": "object",
                        "description": "Layout size configuration",
                        "nullable": true,
                        "properties": {
                          "Height": {
                            "type": "number",
                            "example": 500
                          },
                          "Width": {
                            "type": "number",
                            "example": 400
                          },
                          "outputHeight": {
                            "type": "number",
                            "example": 1000
                          },
                          "outputWidth": {
                            "type": "number",
                            "example": 800
                          },
                          "SvgLayoutUrl": {
                            "type": "string",
                            "example": "http://example.com/svg-layout.svg"
                          },
                          "orignalSVG": {
                            "type": "string",
                            "example": "http://example.com/original.svg"
                          }
                        }
                      },
                      "json_objects": {
                        "type": "object",
                        "description": "JSON objects data",
                        "example": {}
                      },
                      "customSize": {
                        "type": "object",
                        "description": "Custom size configuration",
                        "nullable": true,
                        "properties": {
                          "canvasWidth": {
                            "type": "number",
                            "example": 1024
                          },
                          "canvasHeight": {
                            "type": "number",
                            "example": 768
                          },
                          "outputHeight": {
                            "type": "number",
                            "example": 1500
                          },
                          "outputWidth": {
                            "type": "number",
                            "example": 1200
                          }
                        }
                      },
                      "name_number_details": {
                        "type": "array",
                        "description": "Name and number details",
                        "nullable": true,
                        "example": []
                      },
                      "productType": {
                        "type": "string",
                        "description": "Type of product",
                        "enum": ["Photoalbum", "Custom Size", "3D Products"],
                        "nullable": true,
                        "example": null
                      }
                    },
                    "required": ["designOrderId", "output_files", "order_id", "designId"]
                  }
                },
                "required": ["designOrderId", "baseUrl", "designData"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Output generation initiated successfully.",
            "summary": "Successful Operation.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Output generation in process for Desgin order ID : 1256"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - Invalid parameters or missing required fields.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Bad Request."
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error - Failed to generate output.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Internal Server Error."
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
