<html>
<body>
    <h1>Subscription Report</h1>

    <p><strong>Total Users:</strong> {{totalUsers}}</p>
    <p><strong>Total Audio:</strong> {{totalAudio}}</p>
    <p><strong>Total Subscriptions:</strong> {{totalSubscriptions}}</p>

    {{#each groupedSubscriptions}}
        <h2>User: {{userName}} ({{userEmail}})</h2>

        <h3>iOS Subscriptions</h3>
        <table border="1" cellpadding="5" cellspacing="0">
            <tr>
                <th>Notification Type</th>
                <th>Original Transaction ID</th>
                <th>Expires Date</th>
                <th>Product ID</th>
                <th>Created At</th>
                <th>Updated At</th>
            </tr>
            {{#each iosSubscriptions}}
            <tr>
                <td>{{notificationType}}</td>
                <td>{{originalTransactionId}}</td>
                <td>{{expiresDate}}</td>
                <td>{{productId}}</td>
                <td>{{createdAt}}</td>
                <td>{{updatedAt}}</td>
            </tr>
            {{/each}}
        </table>

        <h3>Web Subscriptions</h3>
        <table border="1" cellpadding="5" cellspacing="0">
            <tr>
                <th>Notification Type</th>
                <th>Original Transaction ID</th>
                <th>Expires Date</th>
                <th>Product ID</th>
                <th>Payment Method</th>
                <th>Payment Status</th>
                <th>Amount</th>
                <th>Currency</th>
                <th>Payment Type</th>
                <th>Period</th>
                <th>Customer Payment ID</th>
                <th>Status</th>
                <th>Created At</th>
                <th>Updated At</th>
            </tr>
            {{#each webSubscriptions}}
            <tr>
                <td>{{notificationType}}</td>
                <td>{{originalTransactionId}}</td>
                <td>{{expiresDate}}</td>
                <td>{{productId}}</td>
                <td>{{paymentMethod}}</td>
                <td>{{paymentStatus}}</td>
                <td>{{amount}}</td>
                <td>{{currency}}</td>
                <td>{{paymentType}}</td>
                <td>{{period}}</td>
                <td>{{customerPaymentId}}</td>
                <td>{{status}}</td>
                <td>{{createdAt}}</td>
                <td>{{updatedAt}}</td>
            </tr>
            {{/each}}
        </table>
    {{/each}}

</body>
</html>
