{
  "info": {
    "_postman_id": "a7e8b1e2-3c4d-5e6f-7g8h-9i0j1k2l3m4n",
    "name": "Quiz System API",
    "description": "A collection for interacting with the Quiz System API, allowing customers to take quizzes, track progress, and receive detailed scores and analytics.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "base_url",
      "value": "http://localhost:8000/api/v1",
      "type": "string"
    }
  ],
  "item": [
    {
      "name": "Authentication",
      "item": [
        {
          "name": "Login",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"email\": \"customer@example.com\",\n    \"password\": \"password\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/auth/login",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "auth",
                "login"
              ]
            },
            "description": "Authenticate a user and retrieve a token"
          },
          "response": [],
          "event": [
            {
              "listen": "test",
              "script": {
                "id": "test-login-script",
                "exec": [
                  "var jsonData = pm.response.json();",
                  "if (jsonData.data && jsonData.data.token) {",
                  "    pm.environment.set(\"token\", jsonData.data.token);",
                  "    console.log(\"Token set to: \" + jsonData.data.token);",
                  "}"
                ],
                "type": "text/javascript"
              }
            }
          ]
        },
        {
          "name": "Register",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"name\": \"New Customer\",\n    \"email\": \"new_customer@example.com\",\n    \"password\": \"password\",\n    \"password_confirmation\": \"password\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/auth/register",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "auth",
                "register"
              ]
            },
            "description": "Register a new customer account"
          },
          "response": []
        },
        {
          "name": "Logout",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/auth/logout",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "auth",
                "logout"
              ]
            },
            "description": "Invalidate the current authentication token"
          },
          "response": [],
          "event": [
            {
              "listen": "test",
              "script": {
                "id": "test-logout-script",
                "exec": [
                  "if (pm.response.code === 200) {",
                  "    pm.environment.unset(\"token\");",
                  "    console.log(\"Token removed\");",
                  "}"
                ],
                "type": "text/javascript"
              }
            }
          ]
        }
      ],
      "description": "Endpoints for user authentication"
    },
    {
      "name": "Quizzes",
      "item": [
        {
          "name": "List Quizzes",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/quizzes?quiz_type=&is_paid=&order_by=created_at&direction=desc&per_page=15&page=1",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "quizzes"
              ],
              "query": [
                {
                  "key": "quiz_type",
                  "value": "",
                  "description": "Filter by quiz type (practice or tryout)"
                },
                {
                  "key": "is_paid",
                  "value": "",
                  "description": "Filter by payment status (true/false)"
                },
                {
                  "key": "order_by",
                  "value": "created_at",
                  "description": "Field to order by"
                },
                {
                  "key": "direction",
                  "value": "desc",
                  "description": "Order direction (asc/desc)"
                },
                {
                  "key": "per_page",
                  "value": "15",
                  "description": "Number of items per page"
                },
                {
                  "key": "page",
                  "value": "1",
                  "description": "Page number for pagination"
                }
              ]
            },
            "description": "Retrieves a list of all available quizzes with optional filtering"
          },
          "response": []
        },
        {
          "name": "Show Quiz Details",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/quizzes/{{quiz_id}}",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "quizzes",
                "{{quiz_id}}"
              ]
            },
            "description": "Retrieves detailed information about a specific quiz"
          },
          "response": [],
          "event": [
            {
              "listen": "test",
              "script": {
                "id": "test-quiz-details-script",
                "exec": [
                  "var jsonData = pm.response.json();",
                  "if (jsonData.status === 'success') {",
                  "    pm.environment.set(\"quiz_id\", jsonData.data.id);",
                  "    console.log(\"Quiz ID set to: \" + jsonData.data.id);",
                  "}"
                ],
                "type": "text/javascript"
              }
            }
          ]
        },
        {
          "name": "Show Quiz with Questions",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/quizzes/{{quiz_id}}/questions?sort=id&direction=asc",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "quizzes",
                "{{quiz_id}}",
                "questions"
              ],
              "query": [
                {
                  "key": "sort",
                  "value": "id",
                  "description": "Field to sort questions by"
                },
                {
                  "key": "direction",
                  "value": "asc",
                  "description": "Sort direction (asc/desc)"
                }
              ]
            },
            "description": "Retrieves a quiz with all its questions and answers"
          },
          "response": []
        }
      ],
      "description": "Endpoints for managing and viewing quizzes"
    },
    {
      "name": "Quiz Sessions",
      "item": [
        {
          "name": "Start Quiz",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/quizzes/{{quiz_id}}/start",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "quizzes",
                "{{quiz_id}}",
                "start"
              ]
            },
            "description": "Creates a new quiz session for a customer or retrieves an existing in-progress session"
          },
          "response": [],
          "event": [
            {
              "listen": "test",
              "script": {
                "id": "test-start-quiz-script",
                "exec": [
                  "var jsonData = pm.response.json();",
                  "if (jsonData.data && jsonData.data.session_id) {",
                  "    pm.environment.set(\"customer_quiz_id\", jsonData.data.session_id);",
                  "    console.log(\"Customer Quiz ID set to: \" + jsonData.data.session_id);",
                  "}"
                ],
                "type": "text/javascript"
              }
            }
          ]
        },
        {
          "name": "Get Quiz Status",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/customer-quizzes/{{customer_quiz_id}}/status",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "customer-quizzes",
                "{{customer_quiz_id}}",
                "status"
              ]
            },
            "description": "Retrieves the current status of an in-progress quiz session, including time information and progress statistics"
          },
          "response": []
        },
        {
          "name": "Submit Answer",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"question_id\": 1,\n    \"selected_answer_id\": 3,\n    \"time_spent\": 45\n}"
            },
            "url": {
              "raw": "{{base_url}}/customer-quizzes/{{customer_quiz_id}}/answer",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "customer-quizzes",
                "{{customer_quiz_id}}",
                "answer"
              ]
            },
            "description": "Submits an answer for a question in an active quiz session"
          },
          "response": []
        },
        {
          "name": "Mark Question as Difficult",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"question_id\": 1,\n    \"is_difficult\": true\n}"
            },
            "url": {
              "raw": "{{base_url}}/customer-quizzes/{{customer_quiz_id}}/difficult",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "customer-quizzes",
                "{{customer_quiz_id}}",
                "difficult"
              ]
            },
            "description": "Marks a question as difficult (or not difficult) for later review"
          },
          "response": []
        },
        {
          "name": "Track Time Spent",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n    \"question_id\": 1,\n    \"time_spent\": 45\n}"
            },
            "url": {
              "raw": "{{base_url}}/customer-quizzes/{{customer_quiz_id}}/track-time",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "customer-quizzes",
                "{{customer_quiz_id}}",
                "track-time"
              ]
            },
            "description": "Updates the time spent on a question without submitting an answer"
          },
          "response": []
        },
        {
          "name": "Get Answer Explanation",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/customer-quizzes/{{customer_quiz_id}}/explain?question_id=1",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "customer-quizzes",
                "{{customer_quiz_id}}",
                "explain"
              ],
              "query": [
                {
                  "key": "question_id",
                  "value": "1",
                  "description": "The ID of the question to explain"
                }
              ]
            },
            "description": "Retrieves detailed explanation for a specific question, showing the correct answer and comparing it with the customer's selection"
          },
          "response": []
        },
        {
          "name": "Complete Quiz",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/customer-quizzes/{{customer_quiz_id}}/complete",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "customer-quizzes",
                "{{customer_quiz_id}}",
                "complete"
              ]
            },
            "description": "Completes an active quiz session and calculates the final score"
          },
          "response": []
        },
        {
          "name": "Get Quiz Results",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/customer-quizzes/{{customer_quiz_id}}/results",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "customer-quizzes",
                "{{customer_quiz_id}}",
                "results"
              ]
            },
            "description": "Retrieves detailed results for a completed quiz"
          },
          "response": []
        },
        {
          "name": "Get Quiz Scorecard",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/customer-quizzes/{{customer_quiz_id}}/scorecard",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "customer-quizzes",
                "{{customer_quiz_id}}",
                "scorecard"
              ]
            },
            "description": "Retrieves a simplified scorecard with performance metrics and comparisons with other customers"
          },
          "response": []
        },
        {
          "name": "Get Tryout Scorecard",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/customer-quizzes/{{customer_quiz_id}}/tryout-scorecard",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "customer-quizzes",
                "{{customer_quiz_id}}",
                "tryout-scorecard"
              ]
            },
            "description": "Retrieves a comprehensive scorecard for tryout quizzes with detailed category and subcategory analysis"
          },
          "response": []
        },
        {
          "name": "Get Quiz History",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/customer-quizzes/history?quiz_type=&status=&from_date=&to_date=&per_page=10&order_by=created_at&direction=desc",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "customer-quizzes",
                "history"
              ],
              "query": [
                {
                  "key": "quiz_type",
                  "value": "",
                  "description": "Filter by quiz type (practice/tryout)"
                },
                {
                  "key": "status",
                  "value": "",
                  "description": "Filter by quiz status (in_progress/completed/abandoned)"
                },
                {
                  "key": "from_date",
                  "value": "",
                  "description": "Filter quizzes started after this date (YYYY-MM-DD)"
                },
                {
                  "key": "to_date",
                  "value": "",
                  "description": "Filter quizzes started before this date (YYYY-MM-DD)"
                },
                {
                  "key": "per_page",
                  "value": "10",
                  "description": "Number of results per page"
                },
                {
                  "key": "order_by",
                  "value": "created_at",
                  "description": "Field to order by"
                },
                {
                  "key": "direction",
                  "value": "desc",
                  "description": "Sort direction (asc/desc)"
                }
              ]
            },
            "description": "Retrieves the customer's quiz history with summary results for each quiz session"
          },
          "response": []
        },
        {
          "name": "Get Quiz Rankings",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/quizzes/{{quiz_id}}/rankings?limit=10&include_current_customer=true",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "quizzes",
                "{{quiz_id}}",
                "rankings"
              ],
              "query": [
                {
                  "key": "limit",
                  "value": "10",
                  "description": "Maximum number of records to return"
                },
                {
                  "key": "include_current_customer",
                  "value": "true",
                  "description": "Whether to include current customer's ranking"
                }
              ]
            },
            "description": "Retrieves ranking information for a quiz, counting only the first attempt by each customer"
          },
          "response": []
        },
        {
          "name": "Get Category Rankings",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              },
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/quizzes/{{quiz_id}}/category-rankings?main_category_id=1&limit=10&include_current_customer=true",
              "host": [
                "{{base_url}}"
              ],
              "path": [
                "quizzes",
                "{{quiz_id}}",
                "category-rankings"
              ],
              "query": [
                {
                  "key": "main_category_id",
                  "value": "1",
                  "description": "ID of the main category to get rankings for"
                },
                {
                  "key": "limit",
                  "value": "10",
                  "description": "Maximum number of records to return"
                },
                {
                  "key": "include_current_customer",
                  "value": "true",
                  "description": "Whether to include current customer's ranking"
                }
              ]
            },
            "description": "Retrieves rankings specific to a main category within a quiz"
          },
          "response": []
        }
      ],
      "description": "Endpoints for quiz sessions, answers, and results"
    }
  ]
} 