Track machine counters and maintenance with counter and time intervals
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Modules\Machines\Domain\Contracts;
|
||||
|
||||
use App\Modules\Machines\Domain\Entities\MaintenanceItem;
|
||||
use DateTimeImmutable;
|
||||
|
||||
/**
|
||||
* Maintenance items, maintenance records and counter readings.
|
||||
*/
|
||||
interface MaintenanceRepository
|
||||
{
|
||||
public function findItem(int $id): ?MaintenanceItem;
|
||||
|
||||
public function saveItem(MaintenanceItem $item): MaintenanceItem;
|
||||
|
||||
/**
|
||||
* The machine a counter belongs to, or null when there is no such counter.
|
||||
*/
|
||||
public function machineOfCounter(int $counterId): ?int;
|
||||
|
||||
public function latestReading(int $counterId): ?int;
|
||||
|
||||
public function addReading(int $counterId, int $readingMilli, int $userId, DateTimeImmutable $at): void;
|
||||
|
||||
/**
|
||||
* @return int The record's id.
|
||||
*/
|
||||
public function addRecord(int $itemId, DateTimeImmutable $performedAt, int $userId, ?int $readingMilli, ?string $note): int;
|
||||
|
||||
/**
|
||||
* @return array{id: int, itemId: int, cancelled: bool}|null
|
||||
*/
|
||||
public function findRecord(int $id): ?array;
|
||||
|
||||
public function cancelRecord(int $id, int $userId, DateTimeImmutable $at): void;
|
||||
}
|
||||
Reference in New Issue
Block a user