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\Pdf\Application\Service;
8
9defined('AMMONLY_APP') || exit('Direct script access is forbidden.');
10
11/**
12 * Contract for PDF document generation services.
13 *
14 * @package App\Modules\Pdf\Application\Service
15 */
16interface PdfGeneratorServiceInterface
17{
18    /**
19     * Generates a PDF document for a single record.
20     *
21     * @param int                       $templateId Target template ID.
22     * @param string                    $moduleName Business module name.
23     * @param int                       $recordId   Primary record identifier.
24     * @param array<string, mixed>|null $user       Current user identity.
25     * @param array<string, mixed>      $options    Rendering options (password, certificate, etc).
26     * @return array<string, string> Dictionary with filename, binary content, and mime_type.
27     */
28    public function generateForRecord(
29        int $templateId,
30        string $moduleName,
31        int $recordId,
32        ?array $user = null,
33        array $options = []
34    ): array;
35
36    /**
37     * Generates a consolidated multi-record PDF document for bulk actions.
38     *
39     * @param int                       $templateId Target template ID.
40     * @param string                    $moduleName Business module name.
41     * @param array<int>                $recordIds  List of selected record IDs.
42     * @param array<string, mixed>|null $user       Current user identity.
43     * @param array<string, mixed>      $options    Rendering options.
44     * @return array<string, string> Dictionary with filename, binary content, and mime_type.
45     */
46    public function generateBulk(
47        int $templateId,
48        string $moduleName,
49        array $recordIds,
50        ?array $user = null,
51        array $options = []
52    ): array;
53
54    /**
55     * Renders self-contained HTML preview for in-browser modal dialog.
56     *
57     * @param int                       $templateId Target template ID.
58     * @param string                    $moduleName Business module name.
59     * @param int                       $recordId   Primary record identifier.
60     * @param array<string, mixed>|null $user       Current user identity.
61     * @return string Complete preview HTML string.
62     */
63    public function renderHtmlPreview(
64        int $templateId,
65        string $moduleName,
66        int $recordId,
67        ?array $user = null
68    ): string;
69}