{
  "info": {
    "_postman_id": "b0bfc9f3-0000-4e5c-8c0a-setup-collection",
    "name": "DIMSE Server API",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "description": "Collection to exercise DIMSE server endpoints (login/register/admin, etc.). Configure environment variables before running."
  },
  "item": [
    {
      "name": "Health",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw": "{{base_url}}/health",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "health"
          ]
        }
      }
    },
    {
      "name": "Register",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "name": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"name\": \"Jane Doe\",\n  \"email\": \"jane@example.com\",\n  \"password\": \"ChangeMe123!\"\n}"
        },
        "url": {
          "raw": "{{base_url}}/auth/register",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "auth",
            "register"
          ]
        }
      }
    },
    {
      "name": "Login",
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "if (pm.response.code === 200) {",
              "  const data = pm.response.json();",
              "  if (data.access_token) pm.environment.set('access_token', data.access_token);",
              "  if (data.refresh_token) pm.environment.set('refresh_token', data.refresh_token);",
              "}",
              ""
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "name": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"username\": \"{{login_email}}\",\n  \"password\": \"{{login_password}}\"\n}"
        },
        "url": {
          "raw": "{{base_url}}/auth/login",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "auth",
            "login"
          ]
        }
      }
    },
    {
      "name": "Refresh",
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "if (pm.response.code === 200) {",
              "  const data = pm.response.json();",
              "  if (data.access_token) pm.environment.set('access_token', data.access_token);",
              "  if (data.refresh_token) pm.environment.set('refresh_token', data.refresh_token);",
              "}",
              ""
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "name": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"refresh_token\": \"{{refresh_token}}\"\n}"
        },
        "url": {
          "raw": "{{base_url}}/auth/refresh",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "auth",
            "refresh"
          ]
        }
      }
    },
    {
      "name": "Me",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{access_token}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{base_url}}/auth/me",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "auth",
            "me"
          ]
        }
      }
    },
    {
      "name": "Admin Users",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{access_token}}",
            "type": "text"
          },
          {
            "key": "Content-Type",
            "name": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"page\": 1,\n  \"pageSize\": 20\n}"
        },
        "url": {
          "raw": "{{base_url}}/admin/users",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "admin",
            "users"
          ]
        }
      }
    }
  ],
  "variable": [
    {
      "key": "base_url",
      "value": "http://localhost:3000"
    },
    {
      "key": "login_email",
      "value": "user@example.com"
    },
    {
      "key": "login_password",
      "value": "your-password"
    },
    {
      "key": "access_token",
      "value": ""
    },
    {
      "key": "refresh_token",
      "value": ""
    }
  ]
}
