{
  "info": {
    "name": "sms-gateway",
    "_postman_id": "1d7a5ab5-8b5d-4b13-8c9f-8d0b1c8a2b0a",
    "description": "SMS Gateway API collection",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "baseUrl", "value": "http://localhost:9990" },
    { "key": "apiKey", "value": "sms_CHANGE_ME" },
    { "key": "clientId", "value": "1" },
    { "key": "applicationId", "value": "1" },
    { "key": "messageClientId", "value": "1" }
  ],
  "item": [
    {
      "name": "Clients",
      "item": [
        {
          "name": "Create client",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" }
            ],
            "url": { "raw": "{{baseUrl}}/api/clients", "host": ["{{baseUrl}}"], "path": ["api", "clients"] },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Acme Corp\",\n  \"email\": \"contact@acme.com\",\n  \"country\": \"Kenya\",\n  \"phoneNumber\": \"+254700000000\"\n}"
            }
          }
        },
        {
          "name": "List clients (paginated)",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{baseUrl}}/api/clients?page=0&size=20&sort=createdAt,desc",
              "host": ["{{baseUrl}}"],
              "path": ["api", "clients"],
              "query": [
                { "key": "page", "value": "0" },
                { "key": "size", "value": "20" },
                { "key": "sort", "value": "createdAt,desc" }
              ]
            }
          }
        },
        {
          "name": "Get client by id",
          "request": {
            "method": "GET",
            "url": { "raw": "{{baseUrl}}/api/clients/{{clientId}}", "host": ["{{baseUrl}}"], "path": ["api", "clients", "{{clientId}}"] }
          }
        },
        {
          "name": "Update client status",
          "request": {
            "method": "PATCH",
            "header": [
              { "key": "Content-Type", "value": "application/json" }
            ],
            "url": { "raw": "{{baseUrl}}/api/clients/{{clientId}}/status", "host": ["{{baseUrl}}"], "path": ["api", "clients", "{{clientId}}", "status"] },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"status\": \"ACTIVE\"\n}"
            }
          }
        }
      ]
    },
    {
      "name": "Applications",
      "item": [
        {
          "name": "Create application (returns apiKey)",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" }
            ],
            "url": { "raw": "{{baseUrl}}/api/applications", "host": ["{{baseUrl}}"], "path": ["api", "applications"] },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"My SMS App\",\n  \"type\": \"LOCAL\",\n  \"orgId\": {{clientId}}\n}"
            }
          }
        },
        {
          "name": "List applications (paginated)",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{baseUrl}}/api/applications?page=0&size=20&sort=createdAt,desc",
              "host": ["{{baseUrl}}"],
              "path": ["api", "applications"],
              "query": [
                { "key": "page", "value": "0" },
                { "key": "size", "value": "20" },
                { "key": "sort", "value": "createdAt,desc" }
              ]
            }
          }
        },
        {
          "name": "List applications by client id (paginated)",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{baseUrl}}/api/applications/client/{{clientId}}?page=0&size=20&sort=createdAt,desc",
              "host": ["{{baseUrl}}"],
              "path": ["api", "applications", "client", "{{clientId}}"],
              "query": [
                { "key": "page", "value": "0" },
                { "key": "size", "value": "20" },
                { "key": "sort", "value": "createdAt,desc" }
              ]
            }
          }
        },
        {
          "name": "Get application by id",
          "request": {
            "method": "GET",
            "url": { "raw": "{{baseUrl}}/api/applications/{{applicationId}}", "host": ["{{baseUrl}}"], "path": ["api", "applications", "{{applicationId}}"] }
          }
        }
      ]
    },
    {
      "name": "SMS",
      "item": [
        {
          "name": "Send SMS (queue message)",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Authorization", "value": "Bearer {{apiKey}}" }
            ],
            "url": { "raw": "{{baseUrl}}/api/sms/send", "host": ["{{baseUrl}}"], "path": ["api", "sms", "send"] },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"from\": \"SENDER_ID\",\n  \"to\": \"2547XXXXXXXX\",\n  \"refId\": \"client-app-ref-12345\",\n  \"message\": \"Hello\"\n}"
            }
          }
        }
      ]
    },
    {
      "name": "Messages",
      "item": [
        {
          "name": "List messages (paginated)",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{baseUrl}}/api/messages?page=0&size=20&sort=createdAt,desc",
              "host": ["{{baseUrl}}"],
              "path": ["api", "messages"],
              "query": [
                { "key": "page", "value": "0" },
                { "key": "size", "value": "20" },
                { "key": "sort", "value": "createdAt,desc" }
              ]
            }
          }
        },
        {
          "name": "List messages by client id (paginated)",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{baseUrl}}/api/messages/client/{{messageClientId}}?page=0&size=20&sort=createdAt,desc",
              "host": ["{{baseUrl}}"],
              "path": ["api", "messages", "client", "{{messageClientId}}"],
              "query": [
                { "key": "page", "value": "0" },
                { "key": "size", "value": "20" },
                { "key": "sort", "value": "createdAt,desc" }
              ]
            }
          }
        }
      ]
    }
  ]
}

