{
"event": "PreToolUse",
"tool_name": "Write",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Domain\/DTO\/PipelineDocumentDTO.php",
"content": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Domain\\DTO;\n\nuse Domain\\ValueObject\\DocumentStatus;\n\n\/\/ @responsibility: DTO für Pipeline-Dokument-Daten\n\nfinal readonly class PipelineDocumentDTO\n{\n public function __construct(\n public int $id,\n public int $pipelineId,\n public string $filename,\n public string $filepath,\n public string $mimeType,\n public int $fileSize,\n public DocumentStatus $status,\n public ?string $errorMessage,\n public int $chunkCount,\n public \\DateTimeImmutable $createdAt,\n public ?\\DateTimeImmutable $processedAt,\n ) {}\n\n \/**\n * Create from database row.\n *\n * @param array<string, mixed> $row\n *\/\n public static function fromDatabaseRow(array $row): self\n {\n return new self(\n id: (int) $row['id'],\n pipelineId: (int) $row['pipeline_id'],\n filename: (string) $row['filename'],\n filepath: (string) $row['filepath'],\n mimeType: (string) ($row['mime_type'] ?? 'application\/octet-stream'),\n fileSize: (int) ($row['file_size'] ?? 0),\n status: DocumentStatus::from((string) ($row['status'] ?? 'pending')),\n errorMessage: $row['error_message'] ?? null,\n chunkCount: (int) ($row['chunk_count'] ?? 0),\n createdAt: new \\DateTimeImmutable($row['created_at'] ?? 'now'),\n processedAt: isset($row['processed_at']) ? new \\DateTimeImmutable($row['processed_at']) : null,\n );\n }\n\n \/**\n * Check if document can be reprocessed.\n *\/\n public function canReprocess(): bool\n {\n return $this->status->canReprocess();\n }\n\n \/**\n * Check if document is currently processing.\n *\/\n public function isProcessing(): bool\n {\n return $this->status->isActive();\n }\n\n \/**\n * Get file size in human-readable format.\n *\/\n public function fileSizeFormatted(): string\n {\n $units = ['B', 'KB', 'MB', 'GB'];\n $size = $this->fileSize;\n $unitIndex = 0;\n\n while ($size >= 1024 && $unitIndex < count($units) - 1) {\n $size \/= 1024;\n $unitIndex++;\n }\n\n return round($size, 2) . ' ' . $units[$unitIndex];\n }\n}\n"
}
}
{
"tool_response": {
"type": "create",
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Domain\/DTO\/PipelineDocumentDTO.php",
"content": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Domain\\DTO;\n\nuse Domain\\ValueObject\\DocumentStatus;\n\n\/\/ @responsibility: DTO für Pipeline-Dokument-Daten\n\nfinal readonly class PipelineDocumentDTO\n{\n public function __construct(\n public int $id,\n public int $pipelineId,\n public string $filename,\n public string $filepath,\n public string $mimeType,\n public int $fileSize,\n public DocumentStatus $status,\n public ?string $errorMessage,\n public int $chunkCount,\n public \\DateTimeImmutable $createdAt,\n public ?\\DateTimeImmutable $processedAt,\n ) {}\n\n \/**\n * Create from database row.\n *\n * @param array<string, mixed> $row\n *\/\n public static function fromDatabaseRow(array $row): self\n {\n return new self(\n id: (int) $row['id'],\n pipelineId: (int) $row['pipeline_id'],\n filename: (string) $row['filename'],\n filepath: (string) $row['filepath'],\n mimeType: (string) ($row['mime_type'] ?? 'application\/octet-stream'),\n fileSize: (int) ($row['file_size'] ?? 0),\n status: DocumentStatus::from((string) ($row['status'] ?? 'pending')),\n errorMessage: $row['error_message'] ?? null,\n chunkCount: (int) ($row['chunk_count'] ?? 0),\n createdAt: new \\DateTimeImmutable($row['created_at'] ?? 'now'),\n processedAt: isset($row['processed_at']) ? new \\DateTimeImmutable($row['processed_at']) : null,\n );\n }\n\n \/**\n * Check if document can be reprocessed.\n *\/\n public function canReprocess(): bool\n {\n return $this->status->canReprocess();\n }\n\n \/**\n * Check if document is currently processing.\n *\/\n public function isProcessing(): bool\n {\n return $this->status->isActive();\n }\n\n \/**\n * Get file size in human-readable format.\n *\/\n public function fileSizeFormatted(): string\n {\n $units = ['B', 'KB', 'MB', 'GB'];\n $size = $this->fileSize;\n $unitIndex = 0;\n\n while ($size >= 1024 && $unitIndex < count($units) - 1) {\n $size \/= 1024;\n $unitIndex++;\n }\n\n return round($size, 2) . ' ' . $units[$unitIndex];\n }\n}\n",
"structuredPatch": [],
"originalFile": null
}
}