<?php $__env->startSection('content'); ?>
<style>
    /* Developer Documentation Master Styles */
    :root {
        --gw-primary: #2563eb;
        --gw-primary-dark: #1d4ed8;
        --gw-dark: #0f172a;
        --gw-dark-card: #1e293b;
        --gw-border: #e2e8f0;
        --gw-bg-subtle: #f8fafc;
        --gw-text-main: #1e293b;
        --gw-text-muted: #64748b;
    }

    .gw-doc-header {
        background: linear-gradient(135deg, #0b1329 0%, #1e293b 50%, #0f172a 100%);
        color: #ffffff;
        padding: 55px 0 45px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    .gw-doc-header h1 {
        font-size: clamp(26px, 3.5vw, 38px);
        font-weight: 800;
        letter-spacing: -0.02em;
        margin-bottom: 10px;
    }
    .gw-doc-header p {
        color: #94a3b8;
        font-size: 15.5px;
        max-width: 780px;
        margin-bottom: 0;
        line-height: 1.6;
    }

    .gw-doc-layout {
        padding: 40px 0 90px;
        background: #f8fafc;
    }

    /* Sticky Sidebar Navigation */
    .gw-sidebar-nav {
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 16px;
        padding: 22px 18px;
        position: sticky;
        top: 90px;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
        box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.04);
    }
    .gw-sidebar-title {
        font-size: 11px;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.09em;
        color: #64748b;
        margin: 16px 0 8px 8px;
    }
    .gw-sidebar-title:first-child {
        margin-top: 0;
    }
    .gw-sidebar-links {
        list-style: none;
        padding: 0;
        margin: 0;
        display: grid;
        gap: 3px;
    }
    .gw-sidebar-links a {
        display: flex;
        align-items: center;
        gap: 9px;
        padding: 7px 10px;
        border-radius: 8px;
        color: #334155;
        font-size: 13px;
        font-weight: 600;
        text-decoration: none;
        transition: all 0.15s ease;
    }
    .gw-sidebar-links a:hover,
    .gw-sidebar-links a.active {
        background: #eff6ff;
        color: #2563eb;
    }
    .gw-sidebar-links a i {
        font-size: 13px;
        width: 16px;
        text-align: center;
    }

    /* Content Cards */
    .gw-doc-card {
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 18px;
        padding: 32px 30px;
        margin-bottom: 28px;
        box-shadow: 0 4px 15px -2px rgba(15, 23, 42, 0.04);
        scroll-margin-top: 90px;
    }
    .gw-doc-card h2 {
        font-size: 22px;
        font-weight: 800;
        color: #0f172a;
        margin-bottom: 8px;
        letter-spacing: -0.02em;
    }
    .gw-doc-card h3 {
        font-size: 17px;
        font-weight: 700;
        color: #0f172a;
        margin-top: 24px;
        margin-bottom: 12px;
    }
    .gw-doc-card p {
        color: #475569;
        font-size: 14.5px;
        line-height: 1.65;
    }

    /* Badges */
    .gw-endpoint-badge {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 6px 12px;
        border-radius: 8px;
        font-family: 'JetBrains Mono', 'Fira Code', monospace;
        font-size: 13px;
        font-weight: 700;
        margin-bottom: 14px;
    }
    .badge-post { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
    .badge-get { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
    .badge-patch { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
    .badge-delete { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

    /* Code Block & Tabs */
    .gw-code-container {
        background: #0b1120 !important;
        border: 1px solid #1e293b !important;
        border-radius: 12px;
        margin: 14px 0 22px;
        overflow: hidden;
    }
    .gw-code-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 16px;
        background: #111827 !important;
        border-bottom: 1px solid #1e293b !important;
    }
    .gw-code-tabs {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }
    .gw-code-tab {
        background: transparent;
        border: none;
        color: #94a3b8 !important;
        font-size: 12px;
        font-weight: 600;
        padding: 5px 12px;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.15s ease;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }
    .gw-code-tab.active {
        background: #2563eb !important;
        color: #ffffff !important;
    }
    .gw-copy-btn {
        background: rgba(255, 255, 255, 0.08) !important;
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        color: #f8fafc !important;
        font-size: 11.5px;
        font-weight: 600;
        padding: 4px 11px;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.15s ease;
    }
    .gw-copy-btn:hover {
        background: rgba(255, 255, 255, 0.2) !important;
        color: #ffffff !important;
    }
    .gw-code-body {
        padding: 16px 20px !important;
        font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace !important;
        font-size: 13.5px !important;
        color: #e2e8f0 !important;
        background-color: transparent !important;
        overflow-x: auto;
        line-height: 1.65 !important;
        margin: 0 !important;
    }
    .gw-code-body code {
        font-family: inherit !important;
        font-size: inherit !important;
        color: #e2e8f0 !important;
        background: transparent !important;
        padding: 0 !important;
        border: none !important;
    }

    /* Syntax Highlighting Colors */
    .tok-kw { color: #38bdf8 !important; font-weight: 600; }
    .tok-cls { color: #f472b6 !important; font-weight: 600; }
    .tok-fn { color: #c084fc !important; }
    .tok-var { color: #fbbf24 !important; }
    .tok-str { color: #4ade80 !important; }
    .tok-num { color: #fb923c !important; }
    .tok-comm { color: #94a3b8 !important; font-style: italic; }

    /* Tables */
    .gw-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 13.5px;
        margin: 16px 0 24px;
    }
    .gw-table th {
        background: #f1f5f9;
        color: #475569;
        font-weight: 700;
        padding: 10px 14px;
        border-bottom: 1px solid #e2e8f0;
        text-align: left;
    }
    .gw-table td {
        padding: 11px 14px;
        border-bottom: 1px solid #f1f5f9;
        color: #334155;
        vertical-align: middle;
    }
    .code-pill {
        font-family: 'JetBrains Mono', 'Fira Code', monospace !important;
        background: #eff6ff !important;
        padding: 2px 7px !important;
        border-radius: 6px !important;
        color: #1d4ed8 !important;
        font-size: 12.5px !important;
        font-weight: 600 !important;
        border: 1px solid #bfdbfe !important;
    }

    .gw-callout {
        border-left: 4px solid #2563eb;
        background: #eff6ff;
        padding: 14px 18px;
        border-radius: 0 10px 10px 0;
        margin: 16px 0 22px;
        font-size: 13.5px;
        color: #1e40af;
    }
    .gw-callout.warning {
        border-left-color: #f59e0b;
        background: #fffbeb;
        color: #b45309;
    }
    .gw-callout.success {
        border-left-color: #10b981;
        background: #ecfdf5;
        color: #047857;
    }
</style>

<!-- Doc Header -->
<section class="gw-doc-header">
    <div class="container">
        <span class="badge bg-primary px-3 py-2 rounded-pill mb-2" style="font-weight: 700;">DEVELOPER REFERENCE</span>
        <h1>SMS Gateway REST API Guideline &amp; Integration Docs</h1>
        <p>Complete documentation for sending SMS, bulk broadcasts, delivery receipts, package quota balance, and multi-language integration (Laravel, Python, Node.js, JavaScript, PHP).</p>
    </div>
</section>

<!-- Doc Layout -->
<section class="gw-doc-layout">
    <div class="container">
        <div class="row g-4">

            <!-- Sidebar -->
            <div class="col-lg-3">
                <nav class="gw-sidebar-nav">
                    <div class="gw-sidebar-title">Getting Started</div>
                    <ul class="gw-sidebar-links">
                        <li><a href="#overview"><i class="fa fa-book text-primary"></i> Overview</a></li>
                        <li><a href="#auth"><i class="fa fa-key text-warning"></i> Authentication</a></li>
                        <li><a href="#verify-token"><i class="fa fa-check-circle text-success"></i> Verify Token API</a></li>
                    </ul>

                    <div class="gw-sidebar-title">Messaging APIs</div>
                    <ul class="gw-sidebar-links">
                        <li><a href="#send-single"><i class="fa fa-paper-plane text-primary"></i> Send Single SMS</a></li>
                        <li><a href="#send-bulk"><i class="fa fa-users text-warning"></i> Send Bulk SMS</a></li>
                        <li><a href="#check-status"><i class="fa fa-info-circle text-info"></i> Check SMS Status</a></li>
                        <li><a href="#check-balance"><i class="fa fa-wallet text-success"></i> Check Balance &amp; Package</a></li>
                        <li><a href="#delivery-history"><i class="fa fa-history text-secondary"></i> Delivery History</a></li>
                        <li><a href="#batch-status"><i class="fa fa-layer-group text-danger"></i> Batch Campaign Status</a></li>
                        <li><a href="#cancel-retry"><i class="fa fa-refresh text-info"></i> Retry &amp; Cancel</a></li>
                    </ul>

                    <div class="gw-sidebar-title">Android Gateway Node</div>
                    <ul class="gw-sidebar-links">
                        <li><a href="#node-overview"><i class="fa fa-mobile-phone text-primary"></i> Mobile Node Setup</a></li>
                        <li><a href="#gw-claim"><i class="fa fa-hand-holding text-warning"></i> Claim Next SMS</a></li>
                        <li><a href="#gw-update"><i class="fa fa-check-double text-success"></i> Report Delivery Status</a></li>
                    </ul>

                    <div class="gw-sidebar-title">Integration &amp; Reference</div>
                    <ul class="gw-sidebar-links">
                        <li><a href="#multi-lang-integration"><i class="fa fa-code text-danger"></i> Tab-by-Tab Integration</a></li>
                        <li><a href="#laravel-integration"><i class="fa fa-laravel text-danger"></i> Laravel Http Guide</a></li>
                        <li><a href="#status-codes"><i class="fa fa-list-ol text-warning"></i> Status &amp; Error Codes</a></li>
                    </ul>
                </nav>
            </div>

            <!-- Content -->
            <div class="col-lg-9">

                <!-- 1. Overview -->
                <article class="gw-doc-card" id="overview">
                    <h2>Overview &amp; Architecture</h2>
                    <p>The SMS Gateway provides high-throughput, carrier-grade SMS routing across all cellular operators in Bangladesh (Grameenphone, Robi, Airtel, Banglalink, Teletalk). All message records are durably maintained on the <code class="code-pill">sms_messages</code> base queue table.</p>

                    <div class="row g-3 mt-2">
                        <div class="col-md-4">
                            <div class="p-3 rounded border bg-light">
                                <h4 style="font-size:14.5px; font-weight:700;" class="text-primary mb-1"><i class="fa fa-database me-1"></i> Base Table</h4>
                                <p class="fs-13 text-muted mb-0">Unified <code class="code-pill">sms_messages</code> table for single, bulk, scheduled, and node-claimed SMS.</p>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="p-3 rounded border bg-light">
                                <h4 style="font-size:14.5px; font-weight:700;" class="text-success mb-1"><i class="fa fa-box me-1"></i> Package Quotas</h4>
                                <p class="fs-13 text-muted mb-0">Automatic enforcement of Per SMS, Daily, and Monthly package quotas and daily limits.</p>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="p-3 rounded border bg-light">
                                <h4 style="font-size:14.5px; font-weight:700;" class="text-info mb-1"><i class="fa fa-mobile me-1"></i> Android Nodes</h4>
                                <p class="fs-13 text-muted mb-0">Connect local Android phones as SIM dispatch gateway nodes via real-time FCM notifications.</p>
                            </div>
                        </div>
                    </div>

                    <div class="gw-callout mt-4">
                        <strong>API Base URL:</strong> <code class="code-pill"><?php echo e(url('/api')); ?></code><br>
                        All requests and responses use standard <code class="code-pill">application/json</code> encoding.
                    </div>
                </article>

                <!-- 2. Authentication -->
                <article class="gw-doc-card" id="auth">
                    <h2>Authentication &amp; API Keys</h2>
                    <p>Every API request must be authenticated using your account's secure API Token. You can generate or regenerate your API token from your admin dashboard at <strong>Settings &rarr; Developers</strong>.</p>

                    <h3>Authentication Methods</h3>
                    <p>The gateway supports three standard authentication methods:</p>

                    <div class="gw-code-container">
                        <div class="gw-code-header">
                            <span class="text-white-50 fs-12">HTTP Header Formats</span>
                            <button class="gw-copy-btn" onclick="copyCode(this)">Copy</button>
                        </div>
                        <pre class="gw-code-body"><code>// Method 1: Bearer Token in Authorization Header (Recommended)
Authorization: Bearer YOUR_API_TOKEN

// Method 2: Custom ApiKey Header
ApiKey: YOUR_API_TOKEN
// or
X-API-KEY: YOUR_API_TOKEN

// Method 3: Request Body or Query Parameter
https://sms.domain.com/api/sent_sms?api_key=YOUR_API_TOKEN</code></pre>
                    </div>
                </article>

                <!-- 3. Verify Token API -->
                <article class="gw-doc-card" id="verify-token">
                    <span class="gw-endpoint-badge badge-post">POST /api/token/verify</span>
                    <h2>Verify API Token &amp; Active Package</h2>
                    <p>Test token validity and inspect active package subscription details, remaining SMS quota, daily limits, and rates.</p>

                    <div class="gw-code-container">
                        <div class="gw-code-header">
                            <span class="text-white-50 fs-12">cURL Request</span>
                            <button class="gw-copy-btn" onclick="copyCode(this)">Copy</button>
                        </div>
                        <pre class="gw-code-body"><code>curl -X POST "<?php echo e(url('/api/token/verify')); ?>" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"</code></pre>
                    </div>

                    <h3>Response (200 OK)</h3>
                    <div class="gw-code-container">
                        <div class="gw-code-header">
                            <span class="text-white-50 fs-12">JSON Response</span>
                            <button class="gw-copy-btn" onclick="copyCode(this)">Copy</button>
                        </div>
                        <pre class="gw-code-body"><code>{
  "status": 2000,
  "success": true,
  "message": "API Token is valid.",
  "data": {
    "user": {
      "id": 1,
      "name": "Acme Enterprise",
      "company_name": "Acme Corp Ltd",
      "masking_rate": 0.45,
      "non_masking_rate": 0.25,
      "status": "active"
    },
    "active_package": {
      "package_name": "Monthly Pro 10K",
      "billing_type": "monthly",
      "total_sms": 10000,
      "used_sms": 1420,
      "remaining_sms": 8580,
      "daily_limit": 500,
      "daily_sent": 68,
      "start_date": "2026-08-01T00:00:00+06:00",
      "expire_date": "2026-09-01T00:00:00+06:00",
      "days_remaining": 12,
      "is_expired": false
    }
  }
}</code></pre>
                    </div>
                </article>

                <!-- 4. Send Single SMS -->
                <article class="gw-doc-card" id="send-single">
                    <span class="gw-endpoint-badge badge-post">POST /api/sent_sms</span>
                    <span class="gw-endpoint-badge badge-post">POST /api/sms/send</span>
                    <h2>Send Single SMS</h2>
                    <p>Submits a single English (GSM 7-bit) or Bangla Unicode message to the <code class="code-pill">sms_messages</code> queue.</p>

                    <h3>Request Parameters</h3>
                    <table class="gw-table">
                        <thead>
                            <tr>
                                <th>Field</th>
                                <th>Type</th>
                                <th>Required</th>
                                <th>Description</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td><code class="code-pill">recipient</code></td>
                                <td>string</td>
                                <td><span class="badge bg-danger">Required</span></td>
                                <td>11-digit or E.164 phone number (e.g. <code class="code-pill">01712345678</code> or <code class="code-pill">+8801712345678</code>)</td>
                            </tr>
                            <tr>
                                <td><code class="code-pill">message</code></td>
                                <td>string</td>
                                <td><span class="badge bg-danger">Required</span></td>
                                <td>Message body text. GSM 160 characters or Unicode 70 characters per SMS part.</td>
                            </tr>
                            <tr>
                                <td><code class="code-pill">sms_type</code></td>
                                <td>string</td>
                                <td>Optional</td>
                                <td><code class="code-pill">masking</code> for Brand CLI or <code class="code-pill">non_masking</code> (Default: non_masking)</td>
                            </tr>
                            <tr>
                                <td><code class="code-pill">device_id</code></td>
                                <td>integer</td>
                                <td>Optional</td>
                                <td>Target specific Android gateway node device ID</td>
                            </tr>
                        </tbody>
                    </table>

                    <div class="gw-code-container">
                        <div class="gw-code-header">
                            <span class="text-white-50 fs-12">cURL Example</span>
                            <button class="gw-copy-btn" onclick="copyCode(this)">Copy</button>
                        </div>
                        <pre class="gw-code-body"><code>curl -X POST "<?php echo e(url('/api/sent_sms')); ?>" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "recipient": "01712345678",
    "message": "Your verification code is 492018. Valid for 5 minutes.",
    "sms_type": "masking"
  }'</code></pre>
                    </div>

                    <h3>Response (200 OK)</h3>
                    <div class="gw-code-container">
                        <div class="gw-code-header">
                            <span class="text-white-50 fs-12">JSON Response</span>
                            <button class="gw-copy-btn" onclick="copyCode(this)">Copy</button>
                        </div>
                        <pre class="gw-code-body"><code>{
  "status": 2000,
  "success": true,
  "message": "SMS submitted to gateway queue successfully.",
  "data": {
    "id": 1058,
    "recipient": "01712345678",
    "message": "Your verification code is 492018. Valid for 5 minutes.",
    "sms_type": "masking",
    "sms_parts": 1,
    "status": "pending",
    "created_at": "2026-08-20T01:35:00+06:00"
  },
  "quota": {
    "remaining_sms": 8579,
    "daily_sent": 69,
    "daily_limit": 500
  }
}</code></pre>
                    </div>
                </article>

                <!-- 5. Send Bulk SMS -->
                <article class="gw-doc-card" id="send-bulk">
                    <span class="gw-endpoint-badge badge-post">POST /api/sms/bulk</span>
                    <h2>Send Bulk SMS</h2>
                    <p>Dispatches an SMS broadcast to an array or comma-delimited list of mobile phone numbers in a single request with batch tracking.</p>

                    <h3>Request Parameters</h3>
                    <table class="gw-table">
                        <thead>
                            <tr>
                                <th>Field</th>
                                <th>Type</th>
                                <th>Required</th>
                                <th>Description</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td><code class="code-pill">recipients</code></td>
                                <td>array | string</td>
                                <td><span class="badge bg-danger">Required</span></td>
                                <td>Array of phone numbers <code class="code-pill">["01712345678", "01812345678"]</code> or comma/newline separated string</td>
                            </tr>
                            <tr>
                                <td><code class="code-pill">message</code></td>
                                <td>string</td>
                                <td><span class="badge bg-danger">Required</span></td>
                                <td>Message body content</td>
                            </tr>
                            <tr>
                                <td><code class="code-pill">sms_type</code></td>
                                <td>string</td>
                                <td>Optional</td>
                                <td><code class="code-pill">masking</code> or <code class="code-pill">non_masking</code></td>
                            </tr>
                        </tbody>
                    </table>

                    <div class="gw-code-container">
                        <div class="gw-code-header">
                            <span class="text-white-50 fs-12">cURL Example</span>
                            <button class="gw-copy-btn" onclick="copyCode(this)">Copy</button>
                        </div>
                        <pre class="gw-code-body"><code>curl -X POST "<?php echo e(url('/api/sms/bulk')); ?>" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "recipients": ["01712345678", "01812345678", "01912345678"],
    "message": "Special flash sale: 20% discount on all items today only!",
    "sms_type": "non_masking"
  }'</code></pre>
                    </div>

                    <h3>Response (200 OK)</h3>
                    <div class="gw-code-container">
                        <div class="gw-code-header">
                            <span class="text-white-50 fs-12">JSON Response</span>
                            <button class="gw-copy-btn" onclick="copyCode(this)">Copy</button>
                        </div>
                        <pre class="gw-code-body"><code>{
  "status": 2000,
  "success": true,
  "message": "Successfully queued 3 messages in batch BATCH_3F92DA_1787168.",
  "data": {
    "batch_id": "BATCH_3F92DA_1787168",
    "total_recipients": 3,
    "sms_parts": 1,
    "total_sms_cost": 3,
    "status": "pending",
    "created_at": "2026-08-20T01:35:10+06:00"
  },
  "quota": {
    "remaining_sms": 8576,
    "daily_sent": 72,
    "daily_limit": 500
  }
}</code></pre>
                    </div>
                </article>

                <!-- 6. Check SMS Status -->
                <article class="gw-doc-card" id="check-status">
                    <span class="gw-endpoint-badge badge-get">GET /api/sms/status/{id}</span>
                    <span class="gw-endpoint-badge badge-post">POST /api/sms/status</span>
                    <h2>Check SMS Delivery Status (DLR)</h2>
                    <p>Query real-time delivery receipt status for a specific message from <code class="code-pill">sms_messages</code> by its ID.</p>

                    <div class="gw-code-container">
                        <div class="gw-code-header">
                            <span class="text-white-50 fs-12">cURL Example</span>
                            <button class="gw-copy-btn" onclick="copyCode(this)">Copy</button>
                        </div>
                        <pre class="gw-code-body"><code>curl -X GET "<?php echo e(url('/api/sms/status/1058')); ?>" \
  -H "Authorization: Bearer YOUR_API_TOKEN"</code></pre>
                    </div>

                    <h3>Response (200 OK)</h3>
                    <div class="gw-code-container">
                        <div class="gw-code-header">
                            <span class="text-white-50 fs-12">JSON Response</span>
                            <button class="gw-copy-btn" onclick="copyCode(this)">Copy</button>
                        </div>
                        <pre class="gw-code-body"><code>{
  "status": 2000,
  "success": true,
  "data": {
    "id": 1058,
    "recipient": "01712345678",
    "message": "Your verification code is 492018.",
    "sms_type": "masking",
    "sms_parts": 1,
    "status": "sent",
    "attempts": 1,
    "claimed_at": "2026-08-20T01:35:02+06:00",
    "sent_at": "2026-08-20T01:35:05+06:00",
    "failed_at": null,
    "last_error": null,
    "created_at": "2026-08-20T01:35:00+06:00"
  }
}</code></pre>
                    </div>
                </article>

                <!-- 7. Check Balance & Package -->
                <article class="gw-doc-card" id="check-balance">
                    <span class="gw-endpoint-badge badge-get">GET /api/balance</span>
                    <span class="gw-endpoint-badge badge-get">GET /api/sms/balance</span>
                    <h2>Check Balance &amp; Active Package</h2>
                    <p>Retrieve remaining SMS balance, active package quotas, daily limit progress, and rates.</p>

                    <div class="gw-code-container">
                        <div class="gw-code-header">
                            <span class="text-white-50 fs-12">cURL Example</span>
                            <button class="gw-copy-btn" onclick="copyCode(this)">Copy</button>
                        </div>
                        <pre class="gw-code-body"><code>curl -X GET "<?php echo e(url('/api/balance')); ?>" \
  -H "Authorization: Bearer YOUR_API_TOKEN"</code></pre>
                    </div>
                </article>

                <!-- 8. Delivery History -->
                <article class="gw-doc-card" id="delivery-history">
                    <span class="gw-endpoint-badge badge-get">GET /api/history</span>
                    <span class="gw-endpoint-badge badge-get">GET /api/sms/history</span>
                    <h2>SMS Delivery Logs &amp; History</h2>
                    <p>Returns a paginated list of all SMS messages sent from your account with optional filtering by status, recipient phone, and date range.</p>

                    <h3>Query Parameters</h3>
                    <table class="gw-table">
                        <thead>
                            <tr>
                                <th>Parameter</th>
                                <th>Type</th>
                                <th>Default</th>
                                <th>Description</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td><code class="code-pill">status</code></td>
                                <td>string</td>
                                <td>null</td>
                                <td>Filter by <code class="code-pill">pending</code>, <code class="code-pill">processing</code>, <code class="code-pill">sent</code>, or <code class="code-pill">failed</code></td>
                            </tr>
                            <tr>
                                <td><code class="code-pill">recipient</code></td>
                                <td>string</td>
                                <td>null</td>
                                <td>Search by recipient phone number</td>
                            </tr>
                            <tr>
                                <td><code class="code-pill">start_date</code></td>
                                <td>date (YYYY-MM-DD)</td>
                                <td>null</td>
                                <td>Filter from start date</td>
                            </tr>
                            <tr>
                                <td><code class="code-pill">end_date</code></td>
                                <td>date (YYYY-MM-DD)</td>
                                <td>null</td>
                                <td>Filter until end date</td>
                            </tr>
                            <tr>
                                <td><code class="code-pill">perPage</code></td>
                                <td>integer</td>
                                <td>20</td>
                                <td>Number of records per page</td>
                            </tr>
                        </tbody>
                    </table>

                    <div class="gw-code-container">
                        <div class="gw-code-header">
                            <span class="text-white-50 fs-12">cURL Example</span>
                            <button class="gw-copy-btn" onclick="copyCode(this)">Copy</button>
                        </div>
                        <pre class="gw-code-body"><code>curl -X GET "<?php echo e(url('/api/history?status=sent&perPage=25')); ?>" \
  -H "Authorization: Bearer YOUR_API_TOKEN"</code></pre>
                    </div>
                </article>

                <!-- 9. Batch Status -->
                <article class="gw-doc-card" id="batch-status">
                    <span class="gw-endpoint-badge badge-get">GET /api/campaign/status</span>
                    <h2>Batch Campaign Status</h2>
                    <p>Query aggregated statistics for a bulk SMS batch using the <code class="code-pill">batch_id</code> returned by the Bulk SMS API.</p>

                    <div class="gw-code-container">
                        <div class="gw-code-header">
                            <span class="text-white-50 fs-12">cURL Example</span>
                            <button class="gw-copy-btn" onclick="copyCode(this)">Copy</button>
                        </div>
                        <pre class="gw-code-body"><code>curl -X GET "<?php echo e(url('/api/campaign/status?batch_id=BATCH_3F92DA_1787168')); ?>" \
  -H "Authorization: Bearer YOUR_API_TOKEN"</code></pre>
                    </div>
                </article>

                <!-- 10. Retry & Cancel -->
                <article class="gw-doc-card" id="cancel-retry">
                    <h2>Retry &amp; Cancel Queue Items</h2>
                    
                    <div class="mb-4">
                        <span class="gw-endpoint-badge badge-post">POST /api/sms/{id}/retry</span>
                        <h3 class="mt-2">Retry Failed SMS</h3>
                        <p>Resets a failed message back to <code class="code-pill">pending</code> status in the queue and notifies connected gateway nodes.</p>
                        <div class="gw-code-container">
                            <div class="gw-code-header">
                                <span class="text-white-50 fs-12">cURL Example</span>
                                <button class="gw-copy-btn" onclick="copyCode(this)">Copy</button>
                            </div>
                            <pre class="gw-code-body"><code>curl -X POST "<?php echo e(url('/api/sms/1058/retry')); ?>" \
  -H "Authorization: Bearer YOUR_API_TOKEN"</code></pre>
                        </div>
                    </div>

                    <div>
                        <span class="gw-endpoint-badge badge-delete">DELETE /api/sms/{id}/cancel</span>
                        <h3 class="mt-2">Cancel Pending SMS</h3>
                        <p>Cancels and removes an unsent message from the queue before it is claimed by a node.</p>
                        <div class="gw-code-container">
                            <div class="gw-code-header">
                                <span class="text-white-50 fs-12">cURL Example</span>
                                <button class="gw-copy-btn" onclick="copyCode(this)">Copy</button>
                            </div>
                            <pre class="gw-code-body"><code>curl -X DELETE "<?php echo e(url('/api/sms/1058/cancel')); ?>" \
  -H "Authorization: Bearer YOUR_API_TOKEN"</code></pre>
                        </div>
                    </div>
                </article>

                <!-- 11. Android Node APIs -->
                <article class="gw-doc-card" id="node-overview">
                    <h2>Android Gateway Node Endpoints</h2>
                    <p>Connect your Android smartphone as an active mobile gateway node for local SIM dispatching. Android nodes communicate directly with the queue using these dedicated endpoints:</p>

                    <div class="mt-4">
                        <span class="gw-endpoint-badge badge-get">GET /api/gateway/sms/status</span>
                        <h4 style="font-size:15px; font-weight:700;">Check Queue Status</h4>
                        <p class="fs-13 text-muted">Returns pending message count and node connection status.</p>
                    </div>

                    <div class="mt-4" id="gw-claim">
                        <span class="gw-endpoint-badge badge-post">POST /api/gateway/sms/claim</span>
                        <h4 style="font-size:15px; font-weight:700;">Claim Next Pending SMS</h4>
                        <p class="fs-13 text-muted">Atomically claims the next pending SMS from <code class="code-pill">sms_messages</code>, marks it <code class="code-pill">processing</code>, and returns payload for SIM transmission.</p>
                    </div>

                    <div class="mt-4" id="gw-update">
                        <span class="gw-endpoint-badge badge-patch">PATCH /api/gateway/sms/{id}/status</span>
                        <h4 style="font-size:15px; font-weight:700;">Report Final Delivery Status</h4>
                        <p class="fs-13 text-muted">Reports whether carrier delivery was successful (<code class="code-pill">sent</code>) or failed (<code class="code-pill">failed</code>).</p>
                    </div>
                </article>

                <!-- 12. Multi-Language Tab-by-Tab Integration Section -->
                <article class="gw-doc-card" id="multi-lang-integration">
                    <h2><i class="fa fa-code text-danger me-2"></i> Multi-Language Integration (Tab by Tab)</h2>
                    <p>Copy-paste complete, ready-to-run boilerplate code for your favorite programming language:</p>

                    <!-- Language Switcher Tabs -->
                    <div class="gw-code-container">
                        <div class="gw-code-header">
                            <div class="gw-code-tabs">
                                <button class="gw-code-tab active" onclick="switchLangTab(event, 'tab-php')">
                                    <i class="fa fa-code"></i> PHP
                                </button>
                                <button class="gw-code-tab" onclick="switchLangTab(event, 'tab-python')">
                                    <i class="fa fa-terminal"></i> Python
                                </button>
                                <button class="gw-code-tab" onclick="switchLangTab(event, 'tab-nodejs')">
                                    <i class="fa fa-server"></i> Node.js
                                </button>
                                <button class="gw-code-tab" onclick="switchLangTab(event, 'tab-javascript')">
                                    <i class="fa fa-globe"></i> JavaScript
                                </button>
                                <button class="gw-code-tab" onclick="switchLangTab(event, 'tab-curl')">
                                    <i class="fa fa-bolt"></i> cURL
                                </button>
                            </div>
                            <button class="gw-copy-btn" onclick="copyCode(this)">Copy Code</button>
                        </div>

                        <!-- 1. PHP TAB -->
                        <pre class="gw-code-body lang-pane" id="tab-php"><code>&lt;?php
/**
 * SMS Gateway PHP Integration (cURL & Guzzle Examples)
 */

$baseUrl = "<?php echo e(url('/api')); ?>";
$token   = "YOUR_API_TOKEN";

// ----------------------------------------------------
// 1. Send Single SMS (cURL)
// ----------------------------------------------------
function sendSingleSms($recipient, $message, $smsType = 'masking') {
    global $baseUrl, $token;
    
    $payload = [
        'recipient' => $recipient,
        'message'   => $message,
        'sms_type'  => $smsType,
    ];

    $ch = curl_init("{$baseUrl}/sent_sms");
    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_POST           => true,
        CURLOPT_POSTFIELDS     => json_encode($payload),
        CURLOPT_HTTPHEADER     => [
            'Content-Type: application/json',
            'Authorization: Bearer ' . $token,
            'Accept: application/json',
        ],
        CURLOPT_TIMEOUT        => 10,
    ]);

    $response = curl_exec($ch);
    curl_close($ch);
    return json_decode($response, true);
}

// ----------------------------------------------------
// 2. Send Bulk SMS (cURL)
// ----------------------------------------------------
function sendBulkSms(array $recipients, $message, $smsType = 'non_masking') {
    global $baseUrl, $token;

    $payload = [
        'recipients' => $recipients,
        'message'    => $message,
        'sms_type'   => $smsType,
    ];

    $ch = curl_init("{$baseUrl}/sms/bulk");
    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_POST           => true,
        CURLOPT_POSTFIELDS     => json_encode($payload),
        CURLOPT_HTTPHEADER     => [
            'Content-Type: application/json',
            'Authorization: Bearer ' . $token,
            'Accept: application/json',
        ],
    ]);

    $response = curl_exec($ch);
    curl_close($ch);
    return json_decode($response, true);
}

// ----------------------------------------------------
// 3. Check Account Balance & Active Package
// ----------------------------------------------------
function checkBalance() {
    global $baseUrl, $token;

    $ch = curl_init("{$baseUrl}/balance");
    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_HTTPHEADER     => [
            'Authorization: Bearer ' . $token,
            'Accept: application/json',
        ],
    ]);

    $response = curl_exec($ch);
    curl_close($ch);
    return json_decode($response, true);
}

// Execute Examples:
$result = sendSingleSms('01712345678', 'Hello from PHP SMS Gateway integration!', 'masking');
print_r($result);
</code></pre>

                        <!-- 2. PYTHON TAB -->
                        <pre class="gw-code-body lang-pane" id="tab-python" style="display:none;"><code>"""
SMS Gateway Python Integration (requests)
Install dependency: pip install requests
"""
import requests

BASE_URL = "<?php echo e(url('/api')); ?>"
API_TOKEN = "YOUR_API_TOKEN"

HEADERS = {
    "Authorization": f"Bearer {API_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json"
}

# ----------------------------------------------------
# 1. Send Single SMS
# ----------------------------------------------------
def send_single_sms(recipient: str, message: str, sms_type: str = "masking"):
    url = f"{BASE_URL}/sent_sms"
    payload = {
        "recipient": recipient,
        "message": message,
        "sms_type": sms_type
    }
    response = requests.post(url, json=payload, headers=HEADERS, timeout=10)
    return response.json()

# ----------------------------------------------------
# 2. Send Bulk SMS
# ----------------------------------------------------
def send_bulk_sms(recipients: list, message: str, sms_type: str = "non_masking"):
    url = f"{BASE_URL}/sms/bulk"
    payload = {
        "recipients": recipients,
        "message": message,
        "sms_type": sms_type
    }
    response = requests.post(url, json=payload, headers=HEADERS, timeout=15)
    return response.json()

# ----------------------------------------------------
# 3. Check Delivery Status by ID
# ----------------------------------------------------
def check_status(sms_id: int):
    url = f"{BASE_URL}/sms/status/{sms_id}"
    response = requests.get(url, headers=HEADERS, timeout=10)
    return response.json()

# ----------------------------------------------------
# 4. Check Balance & Active Package
# ----------------------------------------------------
def check_balance():
    url = f"{BASE_URL}/balance"
    response = requests.get(url, headers=HEADERS, timeout=10)
    return response.json()

# Run Example
if __name__ == "__main__":
    res = send_single_sms("01712345678", "Hello from Python SMS Gateway!", "masking")
    print("Send Result:", res)

    balance = check_balance()
    print("Account Balance:", balance)
</code></pre>

                        <!-- 3. NODE.JS TAB -->
                        <pre class="gw-code-body lang-pane" id="tab-nodejs" style="display:none;"><code>/**
 * SMS Gateway Node.js Integration (Axios / Fetch)
 * Install: npm install axios
 */
const axios = require('axios');

const BASE_URL = '<?php echo e(url('/api')); ?>';
const API_TOKEN = 'YOUR_API_TOKEN';

const apiClient = axios.create({
  baseURL: BASE_URL,
  timeout: 10000,
  headers: {
    'Authorization': `Bearer ${API_TOKEN}`,
    'Content-Type': 'application/json',
    'Accept': 'application/json',
  },
});

// 1. Send Single SMS
async function sendSingleSms(recipient, message, smsType = 'masking') {
  try {
    const response = await apiClient.post('/sent_sms', {
      recipient,
      message,
      sms_type: smsType,
    });
    return response.data;
  } catch (error) {
    console.error('Error sending SMS:', error.response?.data || error.message);
    throw error;
  }
}

// 2. Send Bulk SMS
async function sendBulkSms(recipients, message, smsType = 'non_masking') {
  try {
    const response = await apiClient.post('/sms/bulk', {
      recipients,
      message,
      sms_type: smsType,
    });
    return response.data;
  } catch (error) {
    console.error('Error sending bulk SMS:', error.response?.data || error.message);
    throw error;
  }
}

// 3. Check SMS Status
async function checkStatus(smsId) {
  const response = await apiClient.get(`/sms/status/${smsId}`);
  return response.data;
}

// 4. Check Balance
async function checkBalance() {
  const response = await apiClient.get('/balance');
  return response.data;
}

// Example usage:
(async () => {
  const result = await sendSingleSms('01712345678', 'Hello from Node.js SMS Gateway!', 'masking');
  console.log('Single SMS result:', result);

  const balance = await checkBalance();
  console.log('Active Balance & Package:', balance);
})();
</code></pre>

                        <!-- 4. JAVASCRIPT TAB -->
                        <pre class="gw-code-body lang-pane" id="tab-javascript" style="display:none;"><code>/**
 * SMS Gateway Browser / Vanilla JavaScript Integration (Fetch API & jQuery)
 */

const BASE_URL = '<?php echo e(url('/api')); ?>';
const API_TOKEN = 'YOUR_API_TOKEN';

// ----------------------------------------------------
// Modern ES6+ Fetch API
// ----------------------------------------------------

// 1. Send Single SMS
async function sendSms(recipient, message, smsType = 'masking') {
  const response = await fetch(`${BASE_URL}/sent_sms`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${API_TOKEN}`,
      'Content-Type': 'application/json',
      'Accept': 'application/json',
    },
    body: JSON.stringify({
      recipient: recipient,
      message: message,
      sms_type: smsType,
    }),
  });

  const data = await response.json();
  if (response.ok && data.success) {
    console.log('SMS Sent Successfully! ID:', data.data.id);
  } else {
    console.error('Error:', data.message);
  }
  return data;
}

// 2. Check Balance
async function getBalance() {
  const response = await fetch(`${BASE_URL}/balance`, {
    method: 'GET',
    headers: {
      'Authorization': `Bearer ${API_TOKEN}`,
      'Accept': 'application/json',
    },
  });
  return await response.json();
}

// ----------------------------------------------------
// jQuery AJAX Example
// ----------------------------------------------------
function sendSmsJQuery(recipient, message) {
  $.ajax({
    url: `${BASE_URL}/sent_sms`,
    type: 'POST',
    contentType: 'application/json',
    headers: {
      'Authorization': `Bearer ${API_TOKEN}`
    },
    data: JSON.stringify({
      recipient: recipient,
      message: message,
      sms_type: 'non_masking'
    }),
    success: function(response) {
      console.log('jQuery Success:', response);
    },
    error: function(xhr) {
      console.error('jQuery Error:', xhr.responseJSON);
    }
  });
}
</code></pre>

                        <!-- 5. CURL TAB -->
                        <pre class="gw-code-body lang-pane" id="tab-curl" style="display:none;"><code># 1. Send Single SMS
curl -X POST "<?php echo e(url('/api/sent_sms')); ?>" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "recipient": "01712345678",
    "message": "Your verification code is 492018.",
    "sms_type": "masking"
  }'

# 2. Send Bulk SMS Broadcast
curl -X POST "<?php echo e(url('/api/sms/bulk')); ?>" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "recipients": ["01712345678", "01812345678", "01912345678"],
    "message": "Special flash discount for our VIP customers!",
    "sms_type": "non_masking"
  }'

# 3. Check Message Delivery Status
curl -X GET "<?php echo e(url('/api/sms/status/1058')); ?>" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

# 4. Check Account Balance & Active Package
curl -X GET "<?php echo e(url('/api/balance')); ?>" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
</code></pre>
                    </div>
                </article>

                <!-- 13. Laravel Http Package Integration Guide -->
                <article class="gw-doc-card" id="laravel-integration">
                    <h2><i class="fa fa-code text-danger me-2"></i> Laravel Integration (via Http Client)</h2>
                    <p>Integrate SMS Gateway into any Laravel project in seconds using Laravel's built-in <code class="code-pill">Illuminate\Support\Facades\Http</code> client package.</p>

                    <!-- Step 1 -->
                    <h3>Step 1: Configure Environment &amp; Services</h3>
                    <p>Add your API endpoint and token to your project's <code class="code-pill">.env</code> file:</p>

                    <div class="gw-code-container">
                        <div class="gw-code-header">
                            <span class="text-white-50 fs-12">.env</span>
                            <button class="gw-copy-btn" onclick="copyCode(this)">Copy</button>
                        </div>
                        <pre class="gw-code-body"><code>SMS_GATEWAY_URL="<?php echo e(url('/api')); ?>"
SMS_GATEWAY_TOKEN="your_generated_api_token_here"</code></pre>
                    </div>

                    <p>Then configure <code class="code-pill">config/services.php</code>:</p>

                    <div class="gw-code-container">
                        <div class="gw-code-header">
                            <span class="text-white-50 fs-12">config/services.php</span>
                            <button class="gw-copy-btn" onclick="copyCode(this)">Copy</button>
                        </div>
                        <pre class="gw-code-body"><code>'sms_gateway' => [
    'base_url' => env('SMS_GATEWAY_URL', '<?php echo e(url('/api')); ?>'),
    'token'    => env('SMS_GATEWAY_TOKEN'),
    'timeout'  => env('SMS_GATEWAY_TIMEOUT', 10),
],</code></pre>
                    </div>

                    <!-- Step 2 -->
                    <h3>Step 2: Create Reusable Service Class</h3>
                    <p>Create a dedicated service class at <code class="code-pill">app/Services/SmsGatewayService.php</code>:</p>

                    <div class="gw-code-container">
                        <div class="gw-code-header">
                            <span class="text-white-50 fs-12">app/Services/SmsGatewayService.php</span>
                            <button class="gw-copy-btn" onclick="copyCode(this)">Copy</button>
                        </div>
                        <pre class="gw-code-body"><code>&lt;?php

namespace App\Services;

use Illuminate\Support\Facades\Http;
use Illuminate\Http\Client\Response;
use Illuminate\Support\Facades\Log;

class SmsGatewayService
{
    protected string $baseUrl;
    protected ?string $token;
    protected int $timeout;

    public function __construct()
    {
        $this->baseUrl = rtrim(config('services.sms_gateway.base_url', '<?php echo e(url('/api')); ?>'), '/');
        $this->token   = config('services.sms_gateway.token');
        $this->timeout = (int) config('services.sms_gateway.timeout', 10);
    }

    /**
     * Send a single SMS.
     */
    public function sendSingle(string $recipient, string $message, string $smsType = 'non_masking'): ?array
    {
        try {
            $response = $this->client()->post("{$this->baseUrl}/sent_sms", [
                'recipient' => $recipient,
                'message'   => $message,
                'sms_type'  => $smsType,
            ]);

            return $response->json();
        } catch (\Throwable $e) {
            Log::error('SMS Gateway Send Single Failed: ' . $e->getMessage());
            return null;
        }
    }

    /**
     * Send Bulk SMS to multiple recipients.
     */
    public function sendBulk(array $recipients, string $message, string $smsType = 'non_masking'): ?array
    {
        try {
            $response = $this->client()->post("{$this->baseUrl}/sms/bulk", [
                'recipients' => $recipients,
                'message'    => $message,
                'sms_type'   => $smsType,
            ]);

            return $response->json();
        } catch (\Throwable $e) {
            Log::error('SMS Gateway Send Bulk Failed: ' . $e->getMessage());
            return null;
        }
    }

    /**
     * Check SMS delivery receipt status by ID.
     */
    public function checkStatus(int $smsId): ?array
    {
        try {
            $response = $this->client()->get("{$this->baseUrl}/sms/status/{$smsId}");
            return $response->json();
        } catch (\Throwable $e) {
            Log::error('SMS Gateway Status Check Failed: ' . $e->getMessage());
            return null;
        }
    }

    /**
     * Check account balance and active package subscription.
     */
    public function checkBalance(): ?array
    {
        try {
            $response = $this->client()->get("{$this->baseUrl}/balance");
            return $response->json();
        } catch (\Throwable $e) {
            Log::error('SMS Gateway Balance Check Failed: ' . $e->getMessage());
            return null;
        }
    }

    /**
     * Build authenticated Http client instance.
     */
    protected function client()
    {
        return Http::withToken($this->token)
            ->acceptJson()
            ->timeout($this->timeout)
            ->retry(2, 200); // 2 retries with 200ms delay on connection failures
    }
}</code></pre>
                    </div>

                    <!-- Step 3 -->
                    <h3>Step 3: Use in Controllers, Jobs, or Services</h3>
                    <p>Inject and use <code class="code-pill">SmsGatewayService</code> anywhere in your Laravel application:</p>

                    <div class="gw-code-container">
                        <div class="gw-code-header">
                            <span class="text-white-50 fs-12">Example Controller Usage</span>
                            <button class="gw-copy-btn" onclick="copyCode(this)">Copy</button>
                        </div>
                        <pre class="gw-code-body"><code>&lt;?php

namespace App\Http\Controllers;

use App\Services\SmsGatewayService;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;

class VerificationController extends Controller
{
    public function sendOtp(Request $request, SmsGatewayService $smsService): JsonResponse
    {
        $request->validate([
            'phone' => 'required|string',
        ]);

        $otp = rand(100000, 999999);
        $message = "Your verification OTP code is: {$otp}. Do not share this code.";

        // Send Single SMS via Gateway
        $result = $smsService->sendSingle(
            recipient: $request->input('phone'),
            message: $message,
            smsType: 'masking' // or 'non_masking'
        );

        if ($result && ($result['success'] ?? false)) {
            return response()->json([
                'success' => true,
                'message' => 'OTP dispatched successfully.',
                'sms_id'  => $result['data']['id'] ?? null,
            ]);
        }

        return response()->json([
            'success' => false,
            'message' => $result['message'] ?? 'Failed to send SMS.',
        ], 400);
    }
}</code></pre>
                    </div>

                    <!-- Direct One-Liner Usage -->
                    <h3>Direct One-Liner Quick Examples</h3>
                    <p>If you prefer quick one-liner dispatches without a custom service class:</p>

                    <div class="gw-code-container">
                        <div class="gw-code-header">
                            <span class="text-white-50 fs-12">One-Liner Dispatches</span>
                            <button class="gw-copy-btn" onclick="copyCode(this)">Copy</button>
                        </div>
                        <pre class="gw-code-body"><code>use Illuminate\Support\Facades\Http;

// 1. Send Single OTP SMS
$response = Http::withToken(config('services.sms_gateway.token'))
    ->post('<?php echo e(url('/api/sent_sms')); ?>', [
        'recipient' => '01712345678',
        'message'   => 'Your login PIN is 849302.',
        'sms_type'  => 'masking',
    ]);

// 2. Send Bulk Broadcast
$bulkResponse = Http::withToken(config('services.sms_gateway.token'))
    ->post('<?php echo e(url('/api/sms/bulk')); ?>', [
        'recipients' => ['01712345678', '01812345678', '01912345678'],
        'message'    => 'Special flash discount for our VIP customers today!',
    ]);

// 3. Query Balance
$balance = Http::withToken(config('services.sms_gateway.token'))
    ->get('<?php echo e(url('/api/balance')); ?>')
    ->json();</code></pre>
                    </div>
                </article>

                <!-- 14. Status & Error Codes -->
                <article class="gw-doc-card" id="status-codes">
                    <h2>Status &amp; Error Code Reference</h2>
                    <table class="gw-table">
                        <thead>
                            <tr>
                                <th style="width:110px;">Code</th>
                                <th>Meaning</th>
                                <th>Description &amp; Recommended Action</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td><span class="badge bg-success">2000</span></td>
                                <td><strong>SUCCESS</strong></td>
                                <td>Request executed successfully. SMS has been placed in the queue.</td>
                            </tr>
                            <tr>
                                <td><span class="badge bg-warning text-dark">4003</span></td>
                                <td><strong>QUOTA_EXCEEDED</strong></td>
                                <td>Package expired or daily SMS limit reached. Upgrade or renew package in portal.</td>
                            </tr>
                            <tr>
                                <td><span class="badge bg-warning text-dark">401</span></td>
                                <td><strong>UNAUTHORIZED</strong></td>
                                <td>Invalid API Token or deactivated user account.</td>
                            </tr>
                            <tr>
                                <td><span class="badge bg-warning text-dark">4022</span></td>
                                <td><strong>VALIDATION_ERROR</strong></td>
                                <td>Invalid recipient phone number format or empty message body.</td>
                            </tr>
                            <tr>
                                <td><span class="badge bg-danger">4004</span></td>
                                <td><strong>NOT_FOUND</strong></td>
                                <td>Requested message ID or batch campaign was not found.</td>
                            </tr>
                            <tr>
                                <td><span class="badge bg-danger">5000</span></td>
                                <td><strong>SERVER_ERROR</strong></td>
                                <td>Internal server error. Retry request or contact gateway support.</td>
                            </tr>
                        </tbody>
                    </table>
                </article>

            </div>
        </div>
    </div>
</section>

<script>
function copyCode(btn) {
    const container = btn.closest('.gw-code-container');
    const pre = container.querySelector('.gw-code-body:not([style*="display: none"]):not([style*="display:none"])') || container.querySelector('.gw-code-body');
    if (!pre) return;
    const text = pre.innerText;
    navigator.clipboard.writeText(text).then(() => {
        const orig = btn.innerText;
        btn.innerText = 'Copied!';
        setTimeout(() => btn.innerText = orig, 1800);
    });
}

function switchLangTab(e, paneId) {
    const btn = e.target.closest('.gw-code-tab');
    const container = btn.closest('.gw-code-container');
    container.querySelectorAll('.gw-code-tab').forEach(t => t.classList.remove('active'));
    btn.classList.add('active');

    container.querySelectorAll('.lang-pane').forEach(p => p.style.display = 'none');
    const target = container.querySelector('#' + paneId);
    if (target) target.style.display = 'block';
}

// Active Sidebar Highlighting on Scroll
document.addEventListener('DOMContentLoaded', () => {
    const links = document.querySelectorAll('.gw-sidebar-links a');
    const sections = document.querySelectorAll('.gw-doc-card');

    window.addEventListener('scroll', () => {
        let current = '';
        sections.forEach(section => {
            const sectionTop = section.offsetTop - 120;
            if (window.scrollY >= sectionTop) {
                current = section.getAttribute('id');
            }
        });

        links.forEach(link => {
            link.classList.remove('active');
            if (link.getAttribute('href') === '#' + current) {
                link.classList.add('active');
            }
        });
    });
});
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('website.webLayouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /var/www/PHPProjects/SMS_Gateway/resources/views/website/api_documentation.blade.php ENDPATH**/ ?>