| 1 |
<?php |
| 2 |
/** |
| 3 |
* System-boundary contract for the deep reconciliation module. |
| 4 |
* |
| 5 |
* Implementations provide infrastructure behavior only. Snapshot validation, |
| 6 |
* keep/delete policy, complete planning, and failure outcomes remain inside |
| 7 |
* Mlsimport_Reconciliation. |
| 8 |
* |
| 9 |
* @package MLSImport |
| 10 |
*/ |
| 11 |
|
| 12 |
if ( ! defined( 'ABSPATH' ) ) { |
| 13 |
exit; |
| 14 |
} |
| 15 |
|
| 16 |
/** |
| 17 |
* Supplies external operations used by one Reconciliation Run. |
| 18 |
*/ |
| 19 |
interface Mlsimport_Reconciliation_Environment { |
| 20 |
|
| 21 |
/** |
| 22 |
* Claim the singleton reconciliation lock. |
| 23 |
* |
| 24 |
* @return bool True when the caller owns the lock. |
| 25 |
*/ |
| 26 |
public function acquire_lock(): bool; |
| 27 |
|
| 28 |
/** |
| 29 |
* Release the singleton lock owned by this environment instance. |
| 30 |
* |
| 31 |
* @return void |
| 32 |
*/ |
| 33 |
public function release_lock(): void; |
| 34 |
|
| 35 |
/** |
| 36 |
* Report whether a manual import or hourly sync is active. |
| 37 |
* |
| 38 |
* @return bool True when reconciliation must postpone. |
| 39 |
*/ |
| 40 |
public function import_or_sync_is_active(): bool; |
| 41 |
|
| 42 |
/** |
| 43 |
* Fetch the raw Reconciliation Snapshot response. |
| 44 |
* |
| 45 |
* @return array<string, mixed> Raw response contract. |
| 46 |
*/ |
| 47 |
public function fetch_snapshot(): array; |
| 48 |
|
| 49 |
/** |
| 50 |
* Read the complete active Managed Listing inventory. |
| 51 |
* |
| 52 |
* @return array<int, array<string, mixed>> Managed Listing records. |
| 53 |
*/ |
| 54 |
public function read_managed_listings(): array; |
| 55 |
|
| 56 |
/** |
| 57 |
* Delete one planned Managed Listing and record successful activity. |
| 58 |
* |
| 59 |
* @param int $listing_id Property post ID. |
| 60 |
* @param string $listing_key ListingKey validated during planning. |
| 61 |
* @param string $reason Stable successful-deletion reason. |
| 62 |
* @return bool True only when deletion completed. |
| 63 |
*/ |
| 64 |
public function delete_managed_listing( int $listing_id, string $listing_key, string $reason ): bool; |
| 65 |
|
| 66 |
/** |
| 67 |
* Schedule a deduplicated retry after the requested delay. |
| 68 |
* |
| 69 |
* @param int $delay_seconds Delay from current time. |
| 70 |
* @return void |
| 71 |
*/ |
| 72 |
public function schedule_retry( int $delay_seconds ): void; |
| 73 |
} |
| 74 |
|