{
	"info": {
		"_postman_id": "aibitsoft-templates-api",
		"name": "AibitSoft Templates API",
		"description": "API collection for testing Template uploads with APK file support",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "Health Check",
			"request": {
				"method": "GET",
				"header": [],
				"url": {
					"raw": "{{base_url}}/api/health",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"api",
						"health"
					]
				},
				"description": "Check if the API server is running"
			},
			"response": []
		},
		{
			"name": "Templates",
			"item": [
				{
					"name": "Get All Templates",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/templates",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"templates"
							]
						},
						"description": "Get all templates"
					},
					"response": []
				},
				{
					"name": "Get Template by ID",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/templates/:id",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"templates",
								":id"
							],
							"variable": [
								{
									"key": "id",
									"value": "template_id_here",
									"description": "Template MongoDB ID"
								}
							]
						},
						"description": "Get a specific template by ID"
					},
					"response": []
				},
				{
					"name": "Create Template (with APK)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{admin_token}}",
								"type": "text"
							}
						],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "title",
									"value": "My Awesome App Template",
									"type": "text"
								},
								{
									"key": "description",
									"value": "A comprehensive mobile app template with modern UI/UX design. **Features include:** User authentication, Dashboard, Profile management, and more.",
									"type": "text"
								},
								{
									"key": "techStacks",
									"value": "React Native, TypeScript, Firebase, Redux",
									"type": "text"
								},
								{
									"key": "features",
									"value": "[{\"category\":\"Authentication\",\"items\":[\"Login/Register\",\"Social Login\",\"Password Reset\"]},{\"category\":\"Features\",\"items\":[\"Dashboard\",\"User Profile\",\"Settings\",\"Notifications\"]}]",
									"type": "text"
								},
								{
									"key": "demoCredentials",
									"value": "{\"username\":\"demo@example.com\",\"password\":\"demo123\"}",
									"type": "text"
								},
								{
									"key": "previewImage",
									"type": "file",
									"src": [],
									"description": "Template preview image (JPG, PNG, WEBP - max 5MB)"
								},
								{
									"key": "apkFile",
									"type": "file",
									"src": [],
									"description": "APK file (optional - max 100MB)"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/api/templates",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"templates"
							]
						},
						"description": "Create a new template with APK file upload. Both previewImage and apkFile should be selected as files."
					},
					"response": []
				},
				{
					"name": "Create Template (without APK)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{admin_token}}",
								"type": "text"
							}
						],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "title",
									"value": "Web Dashboard Template",
									"type": "text"
								},
								{
									"key": "description",
									"value": "A modern web dashboard template built with **Next.js** and Tailwind CSS.",
									"type": "text"
								},
								{
									"key": "techStacks",
									"value": "Next.js, React, TypeScript, Tailwind CSS",
									"type": "text"
								},
								{
									"key": "features",
									"value": "[{\"category\":\"Components\",\"items\":[\"Charts\",\"Tables\",\"Forms\",\"Modals\"]},{\"category\":\"Features\",\"items\":[\"Dark Mode\",\"Responsive Design\",\"Authentication\"]}]",
									"type": "text"
								},
								{
									"key": "previewImage",
									"type": "file",
									"src": [],
									"description": "Template preview image (required)"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/api/templates",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"templates"
							]
						},
						"description": "Create a template without APK file (APK is optional)"
					},
					"response": []
				},
				{
					"name": "Delete Template",
					"request": {
						"method": "DELETE",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{admin_token}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/templates/:id",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"templates",
								":id"
							],
							"variable": [
								{
									"key": "id",
									"value": "template_id_here",
									"description": "Template MongoDB ID"
								}
							]
						},
						"description": "Delete a template by ID"
					},
					"response": []
				}
			],
			"description": "Template CRUD operations"
		},
		{
			"name": "APK Downloads",
			"item": [
				{
					"name": "Download APK File",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/api/files/apks/:filename",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"files",
								"apks",
								":filename"
							],
							"variable": [
								{
									"key": "filename",
									"value": "apk-1234567890-1234567890-app.apk",
									"description": "APK filename from template.apkFileName"
								}
							]
						},
						"description": "Download APK file. Use the filename from template.apkFileName field."
					},
					"response": []
				}
			],
			"description": "APK file download endpoints"
		},
		{
			"name": "Authentication",
			"item": [
				{
					"name": "Admin Login",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"email\": \"admin@example.com\",\n  \"password\": \"your_password\"\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "{{base_url}}/api/auth/login",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"auth",
								"login"
							]
						},
						"description": "Login as admin to get authentication token. Use the token in Authorization header for protected routes."
					},
					"response": []
				}
			],
			"description": "Authentication endpoints"
		}
	],
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		}
	],
	"variable": [
		{
			"key": "base_url",
			"value": "http://localhost:4000",
			"type": "string"
		},
		{
			"key": "admin_token",
			"value": "",
			"type": "string",
			"description": "JWT token from admin login. Update this after logging in."
		}
	]
}

