| 1 |
<?php |
| 2 |
/** |
| 3 |
* Setup Wizard checkpoint persistence contract. |
| 4 |
* |
| 5 |
* @package Booking Calendar |
| 6 |
*/ |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
exit; |
| 10 |
} |
| 11 |
|
| 12 |
/** |
| 13 |
* Define the persistence operations required by progressive step saving. |
| 14 |
* |
| 15 |
* The coordinator depends on this narrow contract so domain save handlers do |
| 16 |
* not learn how wizard metadata is stored. Implementations must remain scoped |
| 17 |
* to the current WordPress site, real user, and effective Booking Calendar |
| 18 |
* owner. |
| 19 |
*/ |
| 20 |
interface WPBC_Setup_Wizard_Checkpoint_Store { |
| 21 |
|
| 22 |
/** |
| 23 |
* Load the normalized checkpoint for the current storage context. |
| 24 |
* |
| 25 |
* @return array<string,mixed> Normalized checkpoint. |
| 26 |
*/ |
| 27 |
public function load(); |
| 28 |
|
| 29 |
/** |
| 30 |
* Return an opaque lock scope for the current storage context. |
| 31 |
* |
| 32 |
* @return string Site-, user-, and owner-scoped lock identifier. |
| 33 |
*/ |
| 34 |
public function get_lock_scope(); |
| 35 |
|
| 36 |
/** |
| 37 |
* Return the server-owned active route for a normalized checkpoint. |
| 38 |
* |
| 39 |
* @param array<string,mixed> $checkpoint Current normalized checkpoint. |
| 40 |
* |
| 41 |
* @return string[] Ordered active step identifiers. |
| 42 |
*/ |
| 43 |
public function get_active_step_ids( array $checkpoint ); |
| 44 |
|
| 45 |
/** |
| 46 |
* Validate a client-observed step and revision against current storage. |
| 47 |
* |
| 48 |
* @param array<string,mixed> $checkpoint Current checkpoint. |
| 49 |
* @param string $client_step_id Client-observed step ID. |
| 50 |
* @param int $expected_revision Client-observed revision. |
| 51 |
* |
| 52 |
* @return true|WP_Error True when current, otherwise a stale-state error. |
| 53 |
*/ |
| 54 |
public function validate_request_state( array $checkpoint, $client_step_id, $expected_revision ); |
| 55 |
|
| 56 |
/** |
| 57 |
* Commit one validated step result and advance through the active route. |
| 58 |
* |
| 59 |
* @param string $client_step_id Step being saved. |
| 60 |
* @param int $expected_revision Client-observed revision. |
| 61 |
* @param array<string,mixed> $validated_fields Validated step fields. |
| 62 |
* @param string $operation_id Stable idempotency identifier. |
| 63 |
* @param array<string,mixed> $operation_result Normalized handler result. |
| 64 |
* @param bool $is_terminal Whether this completes the route. |
| 65 |
* |
| 66 |
* @return array<string,mixed>|WP_Error Updated checkpoint or error. |
| 67 |
*/ |
| 68 |
public function commit_step_save( $client_step_id, $expected_revision, array $validated_fields, $operation_id, array $operation_result, $is_terminal ); |
| 69 |
} |
| 70 |
|