| 1 |
<?php |
| 2 |
/** |
| 3 |
* Client Repository Interface |
| 4 |
* |
| 5 |
* @package Easy_Invoice |
| 6 |
* @subpackage Interfaces |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace EasyInvoice\Interfaces; |
| 10 |
|
| 11 |
use EasyInvoice\Models\Client; |
| 12 |
|
| 13 |
/** |
| 14 |
* ClientRepositoryInterface Interface |
| 15 |
* |
| 16 |
* Defines the contract for client repositories. |
| 17 |
*/ |
| 18 |
interface ClientRepositoryInterface { |
| 19 |
/** |
| 20 |
* Find a client by ID |
| 21 |
* |
| 22 |
* @param int $id The client ID |
| 23 |
* @return Client|null The client model or null if not found |
| 24 |
*/ |
| 25 |
public function find($id); |
| 26 |
|
| 27 |
/** |
| 28 |
* Get all clients |
| 29 |
* |
| 30 |
* @param array $args Optional arguments to filter the results |
| 31 |
* @return array Array of Client models |
| 32 |
*/ |
| 33 |
public function all($args = []); |
| 34 |
|
| 35 |
/** |
| 36 |
* Create a new client |
| 37 |
* |
| 38 |
* @param array $data The client data |
| 39 |
* @return Client The created client model |
| 40 |
*/ |
| 41 |
public function create($data); |
| 42 |
|
| 43 |
/** |
| 44 |
* Update an existing client |
| 45 |
* |
| 46 |
* @param int $id The client ID |
| 47 |
* @param array $data The client data |
| 48 |
* @return Client|null The updated client model or null if not found |
| 49 |
*/ |
| 50 |
public function update($id, $data); |
| 51 |
|
| 52 |
/** |
| 53 |
* Delete a client |
| 54 |
* |
| 55 |
* @param int $id The client ID |
| 56 |
* @return bool True if successful, false otherwise |
| 57 |
*/ |
| 58 |
public function delete($id); |
| 59 |
|
| 60 |
/** |
| 61 |
* Find clients by email |
| 62 |
* |
| 63 |
* @param string $email The client email |
| 64 |
* @return array Array of Client models |
| 65 |
*/ |
| 66 |
public function findByEmail($email); |
| 67 |
|
| 68 |
/** |
| 69 |
* Find clients by company name |
| 70 |
* |
| 71 |
* @param string $business_client_name The company name |
| 72 |
* @return array Array of Client models |
| 73 |
*/ |
| 74 |
public function findByBusinessClientName($business_client_name); |
| 75 |
|
| 76 |
/** |
| 77 |
* Search clients by name, email, or company |
| 78 |
* |
| 79 |
* @param string $query The search query |
| 80 |
* @return array Array of Client models |
| 81 |
*/ |
| 82 |
public function search($query); |
| 83 |
} |