{
  "info": {
    "name": "Logistics Optimizer API",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "description": "Complete API collection for AI-Enabled Logistics Optimizer"
  },
  "variable": [
    {
      "key": "base_url",
      "value": "http://localhost/logistics/api"
    },
    {
      "key": "token",
      "value": ""
    }
  ],
  "item": [
    {
      "name": "Authentication",
      "item": [
        {
          "name": "Register User",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"username\": \"testuser\",\n  \"email\": \"test@example.com\",\n  \"password\": \"password123\",\n  \"role\": \"logistics_planner\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/auth/register",
              "host": ["{{base_url}}"],
              "path": ["auth", "register"]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"success\": true,\n  \"message\": \"User registered successfully\",\n  \"user_id\": 4\n}"
            }
          ]
        },
        {
          "name": "Login",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"username\": \"admin\",\n  \"password\": \"password123\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/auth/login",
              "host": ["{{base_url}}"],
              "path": ["auth", "login"]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"success\": true,\n  \"token\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJyb2xlIjoiYWRtaW4iLCJpYXQiOjE2NzM4NjQwMDAsImV4cCI6MTY3Mzg2NzYwMH0.signature\",\n  \"role\": \"admin\",\n  \"expires_in\": 3600\n}"
            }
          ]
        },
        {
          "name": "Get Profile",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/auth/profile",
              "host": ["{{base_url}}"],
              "path": ["auth", "profile"]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"id\": 1,\n  \"username\": \"admin\",\n  \"email\": \"admin@example.com\",\n  \"role\": \"admin\",\n  \"created_at\": \"2023-01-01 00:00:00\"\n}"
            }
          ]
        },
        {
          "name": "Forgot Password",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"admin@example.com\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/auth/forgot-password",
              "host": ["{{base_url}}"],
              "path": ["auth", "forgot-password"]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"success\": true,\n  \"message\": \"If the email exists, a reset link has been sent\",\n  \"reset_token\": \"demo_token_here\"\n}"
            }
          ]
        },
        {
          "name": "Reset Password",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"token\": \"demo_token_here\",\n  \"new_password\": \"newpassword123\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/auth/reset-password",
              "host": ["{{base_url}}"],
              "path": ["auth", "reset-password"]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"success\": true,\n  \"message\": \"Password reset successfully\"\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "Vessel Management",
      "item": [
        {
          "name": "Get Vessels",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/vessels/index.php",
              "host": ["{{base_url}}"],
              "path": ["vessels", "index.php"]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "[\n  {\n    \"id\": 1,\n    \"name\": \"Vessel A\",\n    \"capacity\": 50000,\n    \"eta\": \"2023-10-01\",\n    \"predicted_delay\": 2.5\n  },\n  {\n    \"id\": 2,\n    \"name\": \"Vessel B\",\n    \"capacity\": 60000,\n    \"eta\": \"2023-10-05\",\n    \"predicted_delay\": 1.8\n  }\n]"
            }
          ]
        },
        {
          "name": "Create Vessel",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Vessel C\",\n  \"capacity\": 55000,\n  \"eta\": \"2023-10-10\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/vessels/index.php",
              "host": ["{{base_url}}"],
              "path": ["vessels", "index.php"]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"success\": true,\n  \"id\": 3\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "Port Management",
      "item": [
        {
          "name": "Get Ports",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/ports/index.php",
              "host": ["{{base_url}}"],
              "path": ["ports", "index.php"]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "[\n  {\n    \"id\": 1,\n    \"name\": \"Paradip\",\n    \"capacity\": 50000,\n    \"location\": \"Odisha\"\n  }\n]"
            }
          ]
        },
        {
          "name": "Create Port",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Haldia\",\n  \"capacity\": 40000,\n  \"location\": \"West Bengal\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/ports/index.php",
              "host": ["{{base_url}}"],
              "path": ["ports", "index.php"]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"success\": true,\n  \"id\": 2\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "Plant Management",
      "item": [
        {
          "name": "Get Plants",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/plants/index.php",
              "host": ["{{base_url}}"],
              "path": ["plants", "index.php"]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "[\n  {\n    \"id\": 1,\n    \"name\": \"Plant A\",\n    \"demand\": 30000,\n    \"location\": \"Rourkela\"\n  }\n]"
            }
          ]
        },
        {
          "name": "Create Plant",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Plant B\",\n  \"demand\": 25000,\n  \"location\": \"Bokaro\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/plants/index.php",
              "host": ["{{base_url}}"],
              "path": ["plants", "index.php"]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"success\": true,\n  \"id\": 2\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "Data Upload",
      "item": [
        {
          "name": "Upload Vessel Data",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "file",
                  "type": "file",
                  "src": []
                },
                {
                  "key": "type",
                  "value": "vessels",
                  "type": "text"
                }
              ]
            },
            "url": {
              "raw": "{{base_url}}/upload/excel.php",
              "host": ["{{base_url}}"],
              "path": ["upload", "excel.php"]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"success\": true,\n  \"message\": \"Data uploaded successfully\",\n  \"records_processed\": 5\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "Plans Management",
      "item": [
        {
          "name": "Get Plans",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/plans/index.php",
              "host": ["{{base_url}}"],
              "path": ["plans", "index.php"]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "[\n  {\n    \"id\": 1,\n    \"user_id\": 2,\n    \"schedule_json\": \"{}\",\n    \"total_cost\": 150000.00,\n    \"status\": \"pending\",\n    \"created_at\": \"2023-10-01 10:00:00\",\n    \"created_by\": \"planner\"\n  }\n]"
            }
          ]
        },
        {
          "name": "Get Plan Details",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/plans/index.php/1",
              "host": ["{{base_url}}"],
              "path": ["plans", "index.php", "1"]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"id\": 1,\n  \"user_id\": 2,\n  \"schedule_json\": \"{\\\"vessel_1\\\": {\\\"port\\\": \\\"Paradip\\\", \\\"plant\\\": \\\"Plant A\\\"}}\",\n  \"total_cost\": 150000.00,\n  \"status\": \"pending\",\n  \"created_at\": \"2023-10-01 10:00:00\",\n  \"created_by\": \"planner\"\n}"
            }
          ]
        },
        {
          "name": "Approve Plan",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/plans/approve.php/1",
              "host": ["{{base_url}}"],
              "path": ["plans", "approve.php", "1"]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"success\": true,\n  \"message\": \"Plan approved successfully\"\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "Reports",
      "item": [
        {
          "name": "Cost Analysis - All Plans",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/reports/cost-analysis.php?period=monthly",
              "host": ["{{base_url}}"],
              "path": ["reports", "cost-analysis.php"],
              "query": [
                {
                  "key": "period",
                  "value": "monthly"
                }
              ]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"period\": \"monthly\",\n  \"total_plans\": 3,\n  \"total_overall_cost\": 420000.00,\n  \"plans\": [\n    {\n      \"plan_id\": 1,\n      \"plan_status\": \"approved\",\n      \"created_by\": \"planner\",\n      \"created_at\": \"2023-10-01 10:00:00\",\n      \"period\": \"monthly\",\n      \"ocean_freight\": 60000.00,\n      \"port_handling\": 37500.00,\n      \"rail_freight\": 30000.00,\n      \"demurrage\": 22500.00,\n      \"total_cost\": 150000.00\n    }\n  ]\n}"
            }
          ]
        },
        {
          "name": "Cost Analysis - Specific Plan",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/reports/cost-analysis.php?plan_id=1&period=monthly",
              "host": ["{{base_url}}"],
              "path": ["reports", "cost-analysis.php"],
              "query": [
                {
                  "key": "plan_id",
                  "value": "1"
                },
                {
                  "key": "period",
                  "value": "monthly"
                }
              ]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"plan_id\": 1,\n  \"plan_status\": \"approved\",\n  \"created_by\": \"planner\",\n  \"period\": \"monthly\",\n  \"ocean_freight\": 60000.00,\n  \"port_handling\": 37500.00,\n  \"rail_freight\": 30000.00,\n  \"demurrage\": 22500.00,\n  \"total_cost\": 150000.00\n}"
            }
          ]
        },
        {
          "name": "KPIs",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/reports/kpi.php",
              "host": ["{{base_url}}"],
              "path": ["reports", "kpi.php"]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"total_plans\": 5,\n  \"total_users\": 10,\n  \"total_vessels\": 8,\n  \"cost_savings_percentage\": 15.5,\n  \"on_time_delivery_percentage\": 92.3,\n  \"utilization_rate_percentage\": 87.1,\n  \"demurrage_reduction_percentage\": 23.7,\n  \"generated_at\": \"2023-10-01 12:00:00\"\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "User Management",
      "item": [
        {
          "name": "List Users",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/users/index.php",
              "host": ["{{base_url}}"],
              "path": ["users", "index.php"]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "[\n  {\n    \"id\": 1,\n    \"username\": \"admin\",\n    \"email\": \"admin@example.com\",\n    \"role\": \"admin\",\n    \"created_at\": \"2023-01-01 00:00:00\"\n  },\n  {\n    \"id\": 2,\n    \"username\": \"planner\",\n    \"email\": \"planner@example.com\",\n    \"role\": \"logistics_planner\",\n    \"created_at\": \"2023-01-02 00:00:00\"\n  }\n]"
            }
          ]
        },
        {
          "name": "Create User",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"username\": \"new_user\",\n  \"email\": \"new@example.com\",\n  \"password\": \"securePass123\",\n  \"role\": \"logistics_planner\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/users/index.php",
              "host": ["{{base_url}}"],
              "path": ["users", "index.php"]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"success\": true,\n  \"message\": \"User created successfully\",\n  \"user_id\": 3\n}"
            }
          ]
        },
        {
          "name": "Get User Details",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/users/user.php/2",
              "host": ["{{base_url}}"],
              "path": ["users", "user.php", "2"]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"id\": 2,\n  \"username\": \"planner\",\n  \"email\": \"planner@example.com\",\n  \"role\": \"logistics_planner\",\n  \"created_at\": \"2023-01-02 00:00:00\"\n}"
            }
          ]
        },
        {
          "name": "Update User",
          "request": {
            "method": "PUT",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"role\": \"operations_manager\",\n  \"email\": \"updated@example.com\"\n}"
            },
            "url": {
              "raw": "{{base_url}}/users/user.php/2",
              "host": ["{{base_url}}"],
              "path": ["users", "user.php", "2"]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"success\": true,\n  \"message\": \"User updated successfully\"\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "Optimization",
      "item": [
        {
          "name": "Run Optimization",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Authorization",
                "value": "Bearer {{token}}"
              }
            ],
            "url": {
              "raw": "{{base_url}}/optimization/run.php",
              "host": ["{{base_url}}"],
              "path": ["optimization", "run.php"]
            }
          },
          "response": [
            {
              "name": "Success Response",
              "originalRequest": {},
              "status": "OK",
              "code": 200,
              "_postman_previewlanguage": "json",
              "header": [
                {
                  "key": "Content-Type",
                  "value": "application/json"
                }
              ],
              "cookie": [],
              "body": "{\n  \"success\": true,\n  \"plan_id\": 1\n}"
            }
          ]
        }
      ]
    }
  ]
}
