70 lines
1.9 KiB
PHP
70 lines
1.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Modules\Catalog\Application\Contracts;
|
|
|
|
use App\Modules\Catalog\Application\DTOs\ServiceSummary;
|
|
use App\Modules\Catalog\Application\DTOs\ServiceUnitNode;
|
|
use App\Modules\Catalog\Application\DTOs\ServiceUnitSummary;
|
|
use App\Modules\Catalog\Application\DTOs\WorkTypeSummary;
|
|
|
|
/**
|
|
* Read side of the catalog. Other modules (customer jobs, tasks, time
|
|
* entries) use this contract, never the module's Eloquent models.
|
|
*/
|
|
interface CatalogQueries
|
|
{
|
|
/**
|
|
* The whole hierarchy in order, for the catalog management page.
|
|
*
|
|
* @return list<ServiceUnitNode>
|
|
*/
|
|
public function tree(bool $includeInactive = true): array;
|
|
|
|
/**
|
|
* Active service units a customer job can be assigned to (not the shared unit).
|
|
*
|
|
* @return list<ServiceUnitSummary>
|
|
*/
|
|
public function activeServiceUnits(): array;
|
|
|
|
/**
|
|
* Active work types of the given service units plus the shared work
|
|
* types, grouped by unit and service.
|
|
*
|
|
* @param list<int> $serviceUnitIds
|
|
* @return list<ServiceUnitNode>
|
|
*/
|
|
public function activeWorkTypesFor(array $serviceUnitIds): array;
|
|
|
|
/**
|
|
* Active service units where stock and machine features are in use
|
|
* (spec 19), in catalog order.
|
|
*
|
|
* @return list<int>
|
|
*/
|
|
public function stockServiceUnitIds(): array;
|
|
|
|
public function findServiceUnit(int $id): ?ServiceUnitSummary;
|
|
|
|
/**
|
|
* Service unit names for many ids at once, active or not.
|
|
*
|
|
* @param list<int> $ids
|
|
* @return array<int, string>
|
|
*/
|
|
public function serviceUnitNames(array $ids): array;
|
|
|
|
public function findService(int $id): ?ServiceSummary;
|
|
|
|
public function findWorkType(int $id): ?WorkTypeSummary;
|
|
|
|
/**
|
|
* The services of a unit in order, for choosing a work type's service.
|
|
*
|
|
* @return list<ServiceSummary>
|
|
*/
|
|
public function servicesOf(int $serviceUnitId): array;
|
|
}
|