Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3namespace App\Http\Repositories\interfaces;
4
5use App\Http\Models\InAppNotification;
6use Illuminate\Database\Eloquent\Collection;
7
8/**
9 * Interface for in-app notification (per-user) data access operations.
10 */
11interface IInAppNotificationRepository
12{
13    /**
14     * Get pending notifications for a user, eager-loading campaigns.
15     *
16     * @return Collection<int, InAppNotification>
17     */
18    public function getPendingForUser(string $userId): Collection;
19
20    /**
21     * Mark a set of notifications as sent.
22     *
23     * @param  array<string>  $ids
24     */
25    public function markAsSent(array $ids): void;
26
27    /**
28     * Update the status and corresponding timestamp of a notification.
29     *
30     * @param  array<string, mixed>  $data
31     */
32    public function updateStatus(InAppNotification $notification, array $data): InAppNotification;
33
34    /**
35     * Find a notification by ID and user ID.
36     */
37    public function getByIdAndUser(string $id, string $userId): ?InAppNotification;
38
39    /**
40     * Bulk-create notification records.
41     *
42     * @param  array<int, array<string, mixed>>  $records
43     */
44    public function createBatch(array $records): void;
45
46    /**
47     * Get campaign IDs that already have records for a user.
48     *
49     * @return array<string>
50     */
51    public function getExistingCampaignIdsForUser(string $userId, array $campaignIds): array;
52
53    /**
54     * Count notifications sent to a user today.
55     */
56    public function countSentTodayForUser(string $userId): int;
57}