1: <?php
2:
3: namespace LaravelUi5\Core\Ui5\Contracts;
4:
5: /**
6: * Defines the contract for a follow-up action that can be executed
7: * as part of a UI5 Report workflow.
8: *
9: * Report actions are triggered by users after a report has been run,
10: * and allow for executing meaningful operations on the result data
11: * (e.g., flagging entries, updating records, or triggering downstream processes).
12: *
13: * Each action class is specific to a single report and should be
14: * registered via Ui5ReportInterface::getActions().
15: */
16: interface ReportActionInterface extends ActionHandlerInterface
17: {
18: /**
19: * Returns a short label for the action.
20: *
21: * Used as the button or menu label in the UI.
22: *
23: * Example: "Discard unbilled hours"
24: *
25: * @return string
26: */
27: public function label(): string;
28:
29: /**
30: * Returns a one-line description of what the action does.
31: *
32: * This will be used in confirmation modals and admin overviews.
33: *
34: * Example: "Marks all listed hours as discarded and non-billable."
35: *
36: * @return string
37: */
38: public function description(): string;
39:
40: /**
41: * Executes the action with the given report context.
42: *
43: * The context contains all selection parameters and filters
44: * as originally passed to the report.
45: *
46: * The return value may be:
47: * - true/false for basic success
48: * - an array with structured feedback
49: * - a string message to be displayed in the UI
50: *
51: * @param array $context
52: * @return ReportActionInterface
53: */
54: public function withContext(array $context): self;
55: }
56: