| 1 |
<?php |
| 2 |
/** |
| 3 |
* Quote Repository Interface |
| 4 |
* |
| 5 |
* @package EasyInvoice |
| 6 |
* @since 1.0.0 |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace EasyInvoice\Interfaces; |
| 10 |
|
| 11 |
use EasyInvoice\Models\Quote; |
| 12 |
|
| 13 |
/** |
| 14 |
* Quote Repository Interface |
| 15 |
* |
| 16 |
* Defines the contract for quote repositories with extensibility for pro features. |
| 17 |
* |
| 18 |
* @since 1.0.0 |
| 19 |
*/ |
| 20 |
interface QuoteRepositoryInterface { |
| 21 |
/** |
| 22 |
* Find quote by ID |
| 23 |
* |
| 24 |
* @param int $id Quote ID |
| 25 |
* @return Quote|null |
| 26 |
*/ |
| 27 |
public function find(int $id): ?Quote; |
| 28 |
|
| 29 |
/** |
| 30 |
* Find all quotes |
| 31 |
* |
| 32 |
* @param array $args Query arguments |
| 33 |
* @return array |
| 34 |
*/ |
| 35 |
public function findAll(array $args = []): array; |
| 36 |
|
| 37 |
/** |
| 38 |
* Find all published quotes |
| 39 |
* |
| 40 |
* @param array $args Query arguments |
| 41 |
* @return array |
| 42 |
*/ |
| 43 |
public function findAllPublished(array $args = []): array; |
| 44 |
|
| 45 |
/** |
| 46 |
* Find quotes by status |
| 47 |
* |
| 48 |
* @param string $status Quote status |
| 49 |
* @return array |
| 50 |
*/ |
| 51 |
public function findByStatus(string $status): array; |
| 52 |
|
| 53 |
/** |
| 54 |
* Find all quote IDs by status |
| 55 |
* |
| 56 |
* @param string $status Quote status |
| 57 |
* @return array |
| 58 |
*/ |
| 59 |
public function findAllIdsByStatus(string $status): array; |
| 60 |
|
| 61 |
/** |
| 62 |
* Find quotes by client |
| 63 |
* |
| 64 |
* @param int $client_id Client ID |
| 65 |
* @return array |
| 66 |
*/ |
| 67 |
public function findByClient(int $client_id): array; |
| 68 |
|
| 69 |
/** |
| 70 |
* Create new quote |
| 71 |
* |
| 72 |
* @param array $data Quote data |
| 73 |
* @return Quote|null |
| 74 |
*/ |
| 75 |
public function create(array $data): ?Quote; |
| 76 |
|
| 77 |
/** |
| 78 |
* Update existing quote |
| 79 |
* |
| 80 |
* @param int $id Quote ID |
| 81 |
* @param array $data Quote data |
| 82 |
* @return Quote|null |
| 83 |
*/ |
| 84 |
public function update(int $id, array $data): ?Quote; |
| 85 |
|
| 86 |
/** |
| 87 |
* Delete quote |
| 88 |
* |
| 89 |
* @param int $id Quote ID |
| 90 |
* @return bool |
| 91 |
*/ |
| 92 |
public function delete(int $id): bool; |
| 93 |
|
| 94 |
/** |
| 95 |
* Force publish quote |
| 96 |
* |
| 97 |
* @param int $id Quote ID |
| 98 |
* @return bool |
| 99 |
*/ |
| 100 |
public function forcePublish($id); |
| 101 |
|
| 102 |
/** |
| 103 |
* Find published quote by ID |
| 104 |
* |
| 105 |
* @param int $id Quote ID |
| 106 |
* @return Quote|null |
| 107 |
*/ |
| 108 |
public function findPublished(int $id): ?Quote; |
| 109 |
|
| 110 |
/** |
| 111 |
* Update all existing draft quotes to published status |
| 112 |
* |
| 113 |
* @return int Number of quotes updated |
| 114 |
*/ |
| 115 |
public function updateAllExistingQuotes(): int; |
| 116 |
|
| 117 |
/** |
| 118 |
* Get statistics |
| 119 |
* |
| 120 |
* @return array |
| 121 |
*/ |
| 122 |
public function getStatistics(): array; |
| 123 |
} |