39 lines
1.0 KiB
PHP
39 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\DTO;
|
|
|
|
use JsonSerializable;
|
|
|
|
class SyncPreviewResult implements JsonSerializable
|
|
{
|
|
public function __construct(
|
|
public readonly string $modelTypeId,
|
|
public readonly string $category,
|
|
public readonly int $itemCount,
|
|
public readonly array $additions = [],
|
|
public readonly array $deletions = [],
|
|
public readonly array $modifications = [],
|
|
) {}
|
|
|
|
public function hasImpact(): bool
|
|
{
|
|
return array_sum($this->additions) > 0
|
|
|| array_sum($this->deletions) > 0
|
|
|| array_sum($this->modifications) > 0;
|
|
}
|
|
|
|
public function jsonSerialize(): array
|
|
{
|
|
return [
|
|
'modelTypeId' => $this->modelTypeId,
|
|
'category' => $this->category,
|
|
'itemCount' => $this->itemCount,
|
|
'additions' => $this->additions,
|
|
'deletions' => $this->deletions,
|
|
'modifications' => $this->modifications,
|
|
];
|
|
}
|
|
}
|