ldc-mesbr-app/src/Domain/Models/ValueObjects/PrintRules.php
2026-09-25 10:14:59 +02:00

25 lines
801 B
PHP

<?php
declare(strict_types=1);
namespace Domain\Models\ValueObjects;
final readonly class PrintRules
{
public function __construct(
public ?int $maxPerCustomer = null,
public ?int $cooldownDays = null,
) {
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.');
}
}
}