Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3declare(strict_types=1);
4
5/** @license For full copyright and license information, please see the LICENSE.md file. */
6
7namespace App\Modules\Mail\Application\Contract;
8
9defined('AMMONLY_APP') || exit('Direct script access is forbidden.');
10
11use App\Modules\Mail\Domain\Model\ClientMailbox;
12
13/**
14 * Inbound Email Synchronization Service Contract.
15 *
16 * Polls active inbound mailboxes over IMAP, matches metadata, creates email records,
17 * and triggers automated workflows for incoming support tickets.
18 *
19 * @package App\Modules\Mail\Application\Contract
20 */
21interface InboundEmailSyncServiceInterface
22{
23    /**
24     * Synchronizes active inbound mailboxes and imports new messages with metadata deduplication.
25     *
26     * @param string|null $targetMailboxEmail Optional specific mailbox email address to filter.
27     * @param int         $limit              Maximum number of messages to fetch per mailbox.
28     * @param bool        $dryRun             Whether to run simulation without database changes.
29     * @param int         $days               Maximum message age in days to scan (0 for no limit).
30     * @return array{mailboxes_checked: int, emails_imported: int, duplicates_merged: int, errors: array<string>}
31     */
32    public function syncInboundMailboxes(
33        ?string $targetMailboxEmail = null,
34        int $limit = 50,
35        bool $dryRun = false,
36        int $days = 3
37    ): array;
38
39    /**
40     * Fetches active shared, central (all@), and helpdesk mailboxes eligible for inbound polling.
41     *
42     * @param string|null $filterEmail Optional specific mailbox filter.
43     * @return array<ClientMailbox> List of inbound mailboxes.
44     */
45    public function findInboundMailboxes(?string $filterEmail = null): array;
46}