{
  "info": {
    "name": "Week 8: Test Scheduling & Notifications",
    "description": "Complete API collection for test scheduling and notifications system",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [
    {
      "name": "Teacher - Test Scheduling",
      "item": [
        {
          "name": "Create Test with Schedule",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{teacher_token}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"test_series_name\": \"Mathematics Final Test\",\n  \"class_id\": 1,\n  \"subject_ids\": [10],\n  \"topic_ids\": [101, 102],\n  \"question_count\": 50,\n  \"per_question_marks\": 1,\n  \"total_time\": 60,\n  \"use_ai_generation\": true,\n  \"consent_given\": true,\n  \"scheduled_at\": \"2025-01-15 10:00:00\",\n  \"auto_publish_results\": true\n}"
            },
            "url": {
              "raw": "{{base_url}}/api/v2/tutor/test-series/auto-generate",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "tutor", "test-series", "auto-generate"]
            }
          },
          "response": []
        },
        {
          "name": "Update Test Schedule",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{teacher_token}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"scheduled_at\": \"2025-01-16 14:00:00\",\n  \"duration_minutes\": 90,\n  \"auto_publish_results\": true\n}"
            },
            "url": {
              "raw": "{{base_url}}/api/v2/tutor/test-series/:id/schedule",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "tutor", "test-series", ":id", "schedule"],
              "variable": [
                {
                  "key": "id",
                  "value": "123"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Cancel Test",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{teacher_token}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v2/tutor/test-series/:id/cancel",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "tutor", "test-series", ":id", "cancel"],
              "variable": [
                {
                  "key": "id",
                  "value": "123"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Get Scheduled Tests",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{teacher_token}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v2/tutor/test-series/scheduled?from_date=2025-01-01&to_date=2025-01-31&include_cancelled=false",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "tutor", "test-series", "scheduled"],
              "query": [
                {
                  "key": "from_date",
                  "value": "2025-01-01"
                },
                {
                  "key": "to_date",
                  "value": "2025-01-31"
                },
                {
                  "key": "include_cancelled",
                  "value": "false"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Get Scheduled Tests (All Time)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{teacher_token}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v2/tutor/test-series/scheduled",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "tutor", "test-series", "scheduled"]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Admin - Queue Monitoring",
      "item": [
        {
          "name": "Get Queue Statistics",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{admin_token}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v2/admin/queue/stats",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "admin", "queue", "stats"]
            }
          },
          "response": []
        },
        {
          "name": "Get Failed Jobs",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{admin_token}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v2/admin/queue/failed-jobs?per_page=50&page=1",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "admin", "queue", "failed-jobs"],
              "query": [
                {
                  "key": "per_page",
                  "value": "50"
                },
                {
                  "key": "page",
                  "value": "1"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Retry Failed Job",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{admin_token}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v2/admin/queue/failed-jobs/:id/retry",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "admin", "queue", "failed-jobs", ":id", "retry"],
              "variable": [
                {
                  "key": "id",
                  "value": "1"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Delete Failed Job",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{admin_token}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v2/admin/queue/failed-jobs/:id",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "admin", "queue", "failed-jobs", ":id"],
              "variable": [
                {
                  "key": "id",
                  "value": "1"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Clear All Failed Jobs",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{admin_token}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v2/admin/queue/failed-jobs",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "admin", "queue", "failed-jobs"]
            }
          },
          "response": []
        },
        {
          "name": "Get Scheduled Notifications (Pending)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{admin_token}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v2/admin/queue/scheduled-notifications?status=pending&per_page=50",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "admin", "queue", "scheduled-notifications"],
              "query": [
                {
                  "key": "status",
                  "value": "pending"
                },
                {
                  "key": "per_page",
                  "value": "50"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Get Scheduled Notifications (Sent)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{admin_token}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v2/admin/queue/scheduled-notifications?status=sent&per_page=50",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "admin", "queue", "scheduled-notifications"],
              "query": [
                {
                  "key": "status",
                  "value": "sent"
                },
                {
                  "key": "per_page",
                  "value": "50"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Get Scheduled Notifications (All)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{admin_token}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v2/admin/queue/scheduled-notifications?status=all&per_page=100",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "admin", "queue", "scheduled-notifications"],
              "query": [
                {
                  "key": "status",
                  "value": "all"
                },
                {
                  "key": "per_page",
                  "value": "100"
                }
              ]
            }
          },
          "response": []
        }
      ]
    },
    {
      "name": "Existing Endpoints (Updated)",
      "item": [
        {
          "name": "Preview Test Series",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{teacher_token}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v2/tutor/test-series/:id/preview",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "tutor", "test-series", ":id", "preview"],
              "variable": [
                {
                  "key": "id",
                  "value": "123"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Get Single Test Series",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{teacher_token}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v2/tutor/test-series/:id",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "tutor", "test-series", ":id"],
              "variable": [
                {
                  "key": "id",
                  "value": "123"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Update Test Series",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{teacher_token}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Updated Test Name\",\n  \"instructions\": \"Updated instructions\",\n  \"total_time\": 90,\n  \"per_ques_mark\": 1.5,\n  \"negative_marks\": 0.25,\n  \"status\": 1\n}"
            },
            "url": {
              "raw": "{{base_url}}/api/v2/tutor/test-series/:id",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "tutor", "test-series", ":id"],
              "variable": [
                {
                  "key": "id",
                  "value": "123"
                }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Delete Test Series",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{teacher_token}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{base_url}}/api/v2/tutor/test-series/:id",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "tutor", "test-series", ":id"],
              "variable": [
                {
                  "key": "id",
                  "value": "123"
                }
              ]
            }
          },
          "response": []
        }
      ]
    }
  ],
  "variable": [
    {
      "key": "base_url",
      "value": "http://localhost:8000",
      "type": "string"
    },
    {
      "key": "teacher_token",
      "value": "your_teacher_bearer_token_here",
      "type": "string"
    },
    {
      "key": "admin_token",
      "value": "your_admin_bearer_token_here",
      "type": "string"
    }
  ]
}
