{
"event": "PreToolUse",
"tool_name": "Edit",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/UseCases\/Command\/CreateContentOrderCommand.php",
"old_string": "<?php\n\nnamespace UseCases\\Command;\n\n\/**\n * Command for creating a new content order.\n *\n * Encapsulates all data needed for content order creation\n * with built-in validation.\n *\/\nfinal class CreateContentOrderCommand",
"new_string": "<?php\n\ndeclare(strict_types=1);\n\nnamespace UseCases\\Command;\n\n\/\/ @responsibility: Command-Objekt für Content-Auftragserstellung\n\nfinal class CreateContentOrderCommand"
}
}
{
"tool_response": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/UseCases\/Command\/CreateContentOrderCommand.php",
"oldString": "<?php\n\nnamespace UseCases\\Command;\n\n\/**\n * Command for creating a new content order.\n *\n * Encapsulates all data needed for content order creation\n * with built-in validation.\n *\/\nfinal class CreateContentOrderCommand",
"newString": "<?php\n\ndeclare(strict_types=1);\n\nnamespace UseCases\\Command;\n\n\/\/ @responsibility: Command-Objekt für Content-Auftragserstellung\n\nfinal class CreateContentOrderCommand",
"originalFile": "<?php\n\nnamespace UseCases\\Command;\n\n\/**\n * Command for creating a new content order.\n *\n * Encapsulates all data needed for content order creation\n * with built-in validation.\n *\/\nfinal class CreateContentOrderCommand\n{\n \/**\n * @param array<string> $collections\n *\/\n public function __construct(\n public readonly string $title,\n public readonly string $briefing,\n public readonly string $model,\n public readonly array $collections,\n public readonly int $contextLimit,\n public readonly ?int $authorProfileId,\n public readonly ?int $contractId,\n public readonly ?int $structureId,\n public readonly string $action,\n ) {\n }\n\n \/**\n * @param array<string, mixed> $data\n *\/\n public static function fromRequest(array $data): self\n {\n $collections = $data['collections'] ?? ['documents'];\n if (!is_array($collections)) {\n $collections = [$collections];\n }\n\n return new self(\n title: trim((string) ($data['title'] ?? '')),\n briefing: trim((string) ($data['briefing'] ?? '')),\n model: (string) ($data['model'] ?? 'mistral'),\n collections: $collections,\n contextLimit: (int) ($data['context_limit'] ?? 5),\n authorProfileId: !empty($data['author_profile_id']) ? (int) $data['author_profile_id'] : null,\n contractId: !empty($data['contract_id']) ? (int) $data['contract_id'] : null,\n structureId: !empty($data['structure_id']) ? (int) $data['structure_id'] : null,\n action: (string) ($data['action'] ?? 'save'),\n );\n }\n\n \/**\n * Validate the command data.\n *\n * @return array<string> List of validation errors (empty if valid)\n *\/\n public function validate(): array\n {\n $errors = [];\n\n if ($this->title === '') {\n $errors[] = 'Titel ist erforderlich.';\n }\n\n if ($this->briefing === '') {\n $errors[] = 'Briefing ist erforderlich.';\n }\n\n if ($this->contextLimit < 1 || $this->contextLimit > 20) {\n $errors[] = 'Context-Limit muss zwischen 1 und 20 liegen.';\n }\n\n if (empty($this->collections)) {\n $errors[] = 'Mindestens eine Collection ist erforderlich.';\n }\n\n return $errors;\n }\n\n public function isValid(): bool\n {\n return $this->validate() === [];\n }\n\n public function shouldGenerate(): bool\n {\n return $this->action === 'generate';\n }\n}\n",
"structuredPatch": [
{
"oldStart": 1,
"oldLines": 13,
"newStart": 1,
"newLines": 11,
"lines": [
" <?php",
" ",
"+declare(strict_types=1);",
"+",
" namespace UseCases\\Command;",
" ",
"-\/**",
"- * Command for creating a new content order.",
"- *",
"- * Encapsulates all data needed for content order creation",
"- * with built-in validation.",
"- *\/",
"+\/\/ @responsibility: Command-Objekt für Content-Auftragserstellung",
"+",
" final class CreateContentOrderCommand",
" {",
" \/**"
]
}
],
"userModified": false,
"replaceAll": false
}
}