{
  "info": {
    "_postman_id": "cabin-timekeeper-collection",
    "name": "Cabin Supervisor Timekeeper API",
    "description": "REST API for Cabin Supervisor Timekeeper Dashboard - Slipstream Mobile",
    "version": "1.0.0",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [
    {
      "name": "Configuration",
      "item": [
        {
          "name": "Get All Triggers",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{jwt_token}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{base_url}}/cabin-supervisor/triggers/configuration.php",
              "host": ["{{base_url}}"],
              "path": ["cabin-supervisor", "triggers", "configuration.php"]
            },
            "description": "Fetch all active cabin trigger configurations"
          }
        }
      ]
    },
    {
      "name": "Triggers",
      "item": [
        {
          "name": "Get Triggers for Flight",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{jwt_token}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{base_url}}/cabin-supervisor/triggers/flight/{{flight_id}}.php?include_completed=true",
              "host": ["{{base_url}}"],
              "path": [
                "cabin-supervisor",
                "triggers",
                "flight",
                "{{flight_id}}.php"
              ],
              "query": [
                {
                  "key": "include_completed",
                  "value": "true"
                }
              ]
            },
            "description": "Get all trigger times recorded for a specific flight"
          }
        },
        {
          "name": "Record/Update Trigger",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{jwt_token}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"flight_id\": {{flight_id}},\n  \"trigger_id\": 1,\n  \"actual_time\": \"2026-05-15 08:05:30\",\n  \"is_completed\": true,\n  \"notes\": \"On time\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/cabin-supervisor/triggers/record.php",
              "host": ["{{base_url}}"],
              "path": ["cabin-supervisor", "triggers", "record.php"]
            },
            "description": "Record or update the actual time for a trigger"
          }
        },
        {
          "name": "Delete Trigger Recording",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{jwt_token}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{base_url}}/cabin-supervisor/triggers/{{trigger_time_id}}.php?reason=Correction",
              "host": ["{{base_url}}"],
              "path": [
                "cabin-supervisor",
                "triggers",
                "{{trigger_time_id}}.php"
              ],
              "query": [
                {
                  "key": "reason",
                  "value": "Correction"
                }
              ]
            },
            "description": "Cancel/clear a trigger recording"
          }
        }
      ]
    },
    {
      "name": "Requests",
      "item": [
        {
          "name": "Create Request",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{jwt_token}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"flight_id\": {{flight_id}},\n  \"request_type\": \"water_refill\",\n  \"notes\": \"Galley 1 and 2 need refill\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/cabin-supervisor/requests/create.php",
              "host": ["{{base_url}}"],
              "path": ["cabin-supervisor", "requests", "create.php"]
            },
            "description": "Create a new cabin supervisor request (water, cleaning, waste, catering)"
          }
        },
        {
          "name": "Get Requests for Flight",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{jwt_token}}",
                "type": "text"
              }
            ],
            "url": {
              "raw": "{{base_url}}/cabin-supervisor/requests/flight/{{flight_id}}.php?status=pending&limit=50",
              "host": ["{{base_url}}"],
              "path": [
                "cabin-supervisor",
                "requests",
                "flight",
                "{{flight_id}}.php"
              ],
              "query": [
                {
                  "key": "status",
                  "value": "pending",
                  "disabled": true
                },
                {
                  "key": "request_type",
                  "value": "water_refill",
                  "disabled": true
                },
                {
                  "key": "limit",
                  "value": "50"
                }
              ]
            },
            "description": "Get all service requests for a flight with optional filters"
          }
        },
        {
          "name": "Update Request Status",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{jwt_token}}",
                "type": "text"
              },
              {
                "key": "Content-Type",
                "value": "application/json",
                "type": "text"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"request_status\": \"in_progress\",\n  \"assigned_to_user_id\": 789,\n  \"notes\": \"Starting galley cleaning\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/cabin-supervisor/requests/{{request_id}}/status.php",
              "host": ["{{base_url}}"],
              "path": [
                "cabin-supervisor",
                "requests",
                "{{request_id}}",
                "status.php"
              ]
            },
            "description": "Update request status (pending → in_progress → completed/cancelled)"
          }
        }
      ]
    }
  ],
  "variable": [
    {
      "key": "base_url",
      "value": "http://localhost/slipstream",
      "type": "string"
    },
    {
      "key": "jwt_token",
      "value": "your-jwt-token-here",
      "type": "string"
    },
    {
      "key": "flight_id",
      "value": "123",
      "type": "string"
    },
    {
      "key": "trigger_time_id",
      "value": "1001",
      "type": "string"
    },
    {
      "key": "request_id",
      "value": "5001",
      "type": "string"
    }
  ]
}
