2026-09-22 13:01:30 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Domain\Models\ValueObjects;
|
|
|
|
|
|
|
|
|
|
final readonly class PrintRules
|
|
|
|
|
{
|
|
|
|
|
public function __construct(
|
|
|
|
|
public ?int $maxPerCustomer = null,
|
|
|
|
|
public ?int $cooldownDays = null,
|
|
|
|
|
) {
|
2026-09-25 09:44:57 +02:00
|
|
|
if (null === $this->maxPerCustomer && null === $this->cooldownDays) {
|
|
|
|
|
throw new \InvalidArgumentException('PrintRules require at least a max per customer or a cooldown days.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (null !== $this->maxPerCustomer && $this->maxPerCustomer <= 0) {
|
|
|
|
|
throw new \InvalidArgumentException('Max per customer must be greater than 0.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (null !== $this->cooldownDays && $this->cooldownDays <= 0) {
|
|
|
|
|
throw new \InvalidArgumentException('Cooldown days must be greater than 0.');
|
|
|
|
|
}
|
2026-09-22 13:01:30 +02:00
|
|
|
}
|
|
|
|
|
}
|