30 lines
919 B
PHP
30 lines
919 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Actions\ProductIncos;
|
|
|
|
use App\Contracts\ActionInput;
|
|
use App\Models\ProductInco;
|
|
use Domain\Enums\Nutriscore;
|
|
use Domain\Models\ValueObjects\NutritionalValues;
|
|
use Webmozart\Assert\Assert;
|
|
|
|
final readonly class UpdateProductIncoInput implements ActionInput
|
|
{
|
|
public function __construct(
|
|
public ProductInco $inco,
|
|
public ?string $ingredients = null,
|
|
public ?string $preparation = null,
|
|
public ?string $servings = null,
|
|
public ?string $allergens = null,
|
|
public ?string $selling_argument = null,
|
|
public ?Nutriscore $nutriscore = null,
|
|
public ?string $nutriscore_args = null,
|
|
public NutritionalValues $nutrition = new NutritionalValues(),
|
|
) {
|
|
if ($this->servings !== null) {
|
|
Assert::maxLength($this->servings, 20, 'Servings cannot exceed 20 characters.');
|
|
}
|
|
}
|
|
}
|