{
	"info": {
		"_postman_id": "a73fe360-2fb3-409a-aee3-bce18c02fcd8",
		"name": "Mosrin AI API",
		"description": "API documentation for mosrin ai.",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "Plans",
			"item": [
				{
					"name": "List Plans",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/plans",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"plans"
							],
							"query": [
								{
									"key": "search",
									"value": "Pro",
									"disabled": true,
									"description": "Search by title"
								},
								{
									"key": "type",
									"value": "plan",
									"disabled": true,
									"description": "Filter by type (plan, topup)"
								},
								{
									"key": "interval",
									"value": "month",
									"disabled": true,
									"description": "Filter by interval (month, week, year)"
								},
								{
									"key": "status",
									"value": "1",
									"disabled": true,
									"description": "Filter by status (1, 0)"
								}
							]
						},
						"description": "Retrieve a paginated list of plans with optional filters."
					},
					"response": []
				},
				{
					"name": "Plan Details",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/plans/:plan_id",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"plans",
								":plan_id"
							]
						},
						"description": "Retrieve details for a specific plan by its UUID."
					},
					"response": []
				},
				{
					"name": "Checkout Plan",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							},
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"user_id\": \"019db9e6-a4f1-7299-82af-02f98138c0c8\"}"
						},
						"url": {
							"raw": "{{base_url}}/api/plans/:plan_id/checkout",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"plans",
								":plan_id",
								"checkout"
							]
						},
						"description": "Initiate checkout for a plan. Returns a redirect URL for payment."
					},
					"response": []
				},
				{
					"name": "Payment Callback (Simulated)",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/payment/callback?session_id=sess_abcd123&success=true&email=user@example.com&name=John Doe",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"payment",
								"callback"
							],
							"query": [
								{
									"key": "session_id",
									"value": "sess_abcd123"
								},
								{
									"key": "success",
									"value": "true"
								},
								{
									"key": "email",
									"value": "user@example.com"
								},
								{
									"key": "name",
									"value": "John Doe"
								}
							]
						},
						"description": "Simulated callback from payment provider. Updates subscription status and sends emails."
					},
					"response": []
				}
			]
		},
		{
			"name": "Usage Logs",
			"item": [
				{
					"name": "List Usage Logs",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/usage-logs",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"usage-logs"
							],
							"query": [
								{
									"key": "user_id",
									"value": "uuid",
									"disabled": true
								},
								{
									"key": "search",
									"value": "term",
									"disabled": true
								}
							]
						},
						"description": "List usage logs with optional filtering by user_id or search term."
					},
					"response": []
				},
				{
					"name": "Store Usage Log",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							},
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"user_id\": \"uuid\",\n    \"action\": \"API Request\",\n    \"coin_spent\": 5,\n    \"remark\": \"Optional remark\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/api/usage-logs",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"usage-logs"
							]
						},
						"description": "Create a new usage log entry."
					},
					"response": []
				}
			]
		},
		{
			"name": "Coins",
			"item": [
				{
					"name": "Check Balance",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/coins/check-balance?user_id=uuid&coin=10",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"coins",
								"check-balance"
							],
							"query": [
								{
									"key": "user_id",
									"value": "uuid"
								},
								{
									"key": "coin",
									"value": "10"
								}
							]
						},
						"description": "Check if a user has sufficient coin balance and an active subscription."
					},
					"response": []
				}
			]
		},
		{
			"name": "Refunds",
			"item": [
				{
					"name": "Request Refund",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							},
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"user_id\": \"uuid\",\n    \"reason\": \"Mistaken purchase.\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/api/refunds",
							"host": [
								"{{base_url}}"
							],
							"path": [
								"api",
								"refunds"
							]
						},
						"description": "Submit a refund request for the user's active subscription."
					},
					"response": []
				}
			]
		}
	],
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		}
	],
	"variable": [
		{
			"key": "base_url",
			"value": "http://localhost:8000",
			"type": "string"
		},
		{
			"key": "plan_id",
			"value": "99e12345-e89b-12d3-a456-426614174000",
			"type": "string"
		}
	]
}