2026-09-29 14:53:02 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2026-11-10 14:28:00 +01:00
|
|
|
namespace App\Cqs\Actions\Faqs;
|
2026-09-29 14:53:02 +02:00
|
|
|
|
|
|
|
|
use App\Contracts\ActionInput;
|
|
|
|
|
use Webmozart\Assert\Assert;
|
|
|
|
|
|
|
|
|
|
final readonly class CreateFaqInput implements ActionInput
|
|
|
|
|
{
|
|
|
|
|
public function __construct(
|
|
|
|
|
public string $question,
|
|
|
|
|
public string $answer,
|
|
|
|
|
) {
|
|
|
|
|
Assert::stringNotEmpty(trim($this->question), 'Question cannot be empty.');
|
|
|
|
|
Assert::minLength(trim($this->question), 4);
|
|
|
|
|
Assert::maxLength($this->question, 255);
|
|
|
|
|
Assert::stringNotEmpty(trim($this->answer), 'Answer cannot be empty.');
|
|
|
|
|
Assert::minLength(trim($this->answer), 4);
|
|
|
|
|
}
|
|
|
|
|
}
|