{
  "info": {
    "name": "Helix AI - Token Quota",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "base_url", "value": "http://localhost:8000" },
    { "key": "jwt", "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoxMDEsImNvbXBhbnlfaWQiOjcsInJvbGVfaWQiOjIsInVzZXJfdHlwZSI6ImVtcGxveWVlIiwiY29tcGFueV9uYW1lIjoiQWNtZSBDb3JwIiwiZXhwIjoxNzgxODY1MjM3fQ.TEXWxuiFMvm45ptDcLglUsSjB8ZVfits6nhLK7vf_IA" },
    { "key": "admin_key", "value": "Wb6xFu2IMZ-fLpPtiVEc-1Koaes55OE6QEUVY-6tgdwdCLwf7so-C0MZsjwAWkcn" },
    { "key": "policy_id", "value": "1" }
  ],
  "item": [
    {
      "name": "1. Chat - hr-assist-stream",
      "request": {
        "method": "POST",
        "header": [
          { "key": "Authorization", "value": "Bearer {{jwt}}" },
          { "key": "Content-Type", "value": "application/json" }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\"query\": \"What is the annual leave policy?\"}"
        },
        "url": "{{base_url}}/hr-assist-stream"
      }
    },
    {
      "name": "2. My Usage",
      "request": {
        "method": "GET",
        "header": [{ "key": "Authorization", "value": "Bearer {{jwt}}" }],
        "url": "{{base_url}}/my-usage"
      }
    },
    {
      "name": "3. Admin - Create Policy",
      "request": {
        "method": "POST",
        "header": [
          { "key": "X-Api-Key", "value": "{{admin_key}}" },
          { "key": "Content-Type", "value": "application/json" }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\"scope_type\": \"user\", \"scope_id\": 101, \"daily_token_limit\": 50}"
        },
        "url": "{{base_url}}/admin/quota/policies"
      }
    },
    {
      "name": "4. Admin - List Policies",
      "request": {
        "method": "GET",
        "header": [{ "key": "X-Api-Key", "value": "{{admin_key}}" }],
        "url": "{{base_url}}/admin/quota/policies"
      }
    },
    {
      "name": "5. Admin - Patch Policy",
      "request": {
        "method": "PATCH",
        "header": [
          { "key": "X-Api-Key", "value": "{{admin_key}}" },
          { "key": "Content-Type", "value": "application/json" }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\"daily_token_limit\": 100000}"
        },
        "url": "{{base_url}}/admin/quota/policies/{{policy_id}}"
      }
    },
    {
      "name": "6. Admin - Delete Policy",
      "request": {
        "method": "DELETE",
        "header": [{ "key": "X-Api-Key", "value": "{{admin_key}}" }],
        "url": "{{base_url}}/admin/quota/policies/{{policy_id}}"
      }
    },
    {
      "name": "7. Admin - Usage Report",
      "request": {
        "method": "GET",
        "header": [{ "key": "X-Api-Key", "value": "{{admin_key}}" }],
        "url": {
          "raw": "{{base_url}}/admin/quota/usage-report?user_id=101",
          "host": ["{{base_url}}"],
          "path": ["admin", "quota", "usage-report"],
          "query": [{ "key": "user_id", "value": "101" }]
        }
      }
    },
    {
      "name": "8. Admin - Missing API Key (expect 401)",
      "request": {
        "method": "GET",
        "header": [],
        "url": "{{base_url}}/admin/quota/policies"
      }
    }
  ]
}
