67 lines
1.5 KiB
PHP
67 lines
1.5 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace Modules\RestaurantDelivery\Contracts;
|
||
|
|
|
||
|
|
use Modules\RestaurantDelivery\Models\Delivery;
|
||
|
|
use Modules\RestaurantDelivery\Models\DeliveryRating;
|
||
|
|
use Modules\RestaurantDelivery\Models\Rider;
|
||
|
|
|
||
|
|
interface RatingServiceInterface
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Create a rating for a delivery.
|
||
|
|
*/
|
||
|
|
public function createRating(
|
||
|
|
Delivery $delivery,
|
||
|
|
int $overallRating,
|
||
|
|
array $categoryRatings = [],
|
||
|
|
?string $review = null,
|
||
|
|
array $tags = [],
|
||
|
|
bool $isAnonymous = false,
|
||
|
|
?int $customerId = null,
|
||
|
|
bool $isRestaurantRating = false
|
||
|
|
): ?DeliveryRating;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Check if delivery can be rated.
|
||
|
|
*/
|
||
|
|
public function canRate(Delivery $delivery, bool $isRestaurantRating = false): bool;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Validate rating value.
|
||
|
|
*/
|
||
|
|
public function isValidRating(int $rating): bool;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Validate review.
|
||
|
|
*/
|
||
|
|
public function isValidReview(?string $review): bool;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Add rider's response to a rating.
|
||
|
|
*/
|
||
|
|
public function addRiderResponse(DeliveryRating $rating, string $response): bool;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Approve a rating.
|
||
|
|
*/
|
||
|
|
public function approveRating(DeliveryRating $rating): void;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Reject a rating.
|
||
|
|
*/
|
||
|
|
public function rejectRating(DeliveryRating $rating, string $reason): void;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get rider's rating statistics.
|
||
|
|
*/
|
||
|
|
public function getRiderStats(Rider $rider): array;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get available rating categories.
|
||
|
|
*/
|
||
|
|
public function getCategories(): array;
|
||
|
|
}
|