Selbstdeklaration des KI-Einsatzes je PM (Text) und je Bild inkl. Submit-Gate im PressReleaseService, versioniertem Audit-Trail (press_release_ai_declarations) und öffentlichem KI-Label in Einreicher-Stimme. Bestätigung im Submit-Modal ist Pflicht. Co-authored-by: Cursor <cursoragent@cursor.com>
75 lines
2.2 KiB
PHP
75 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Enums\AiTextDeclaration;
|
|
use App\Enums\Portal;
|
|
use App\Enums\PressReleaseStatus;
|
|
use App\Models\Category;
|
|
use App\Models\Company;
|
|
use App\Models\PressRelease;
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
|
|
/**
|
|
* @extends Factory<PressRelease>
|
|
*/
|
|
class PressReleaseFactory extends Factory
|
|
{
|
|
protected $model = PressRelease::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
$title = fake()->sentence(6);
|
|
|
|
return [
|
|
'uuid' => (string) Str::uuid(),
|
|
'portal' => fake()->randomElement([Portal::Presseecho->value, Portal::Businessportal24->value]),
|
|
'user_id' => User::factory(),
|
|
'company_id' => Company::factory(),
|
|
'category_id' => Category::factory(),
|
|
'language' => 'de',
|
|
'title' => $title,
|
|
'slug' => Str::slug($title).'-'.fake()->unique()->numberBetween(1000, 9999),
|
|
'text' => fake()->paragraphs(3, true),
|
|
'status' => PressReleaseStatus::Draft->value,
|
|
'hits' => 0,
|
|
'no_export' => false,
|
|
// KI-Kennzeichnung (Art. 50 KI-VO): Standard „ohne KI", bestätigt —
|
|
// damit erfüllen Test-PMs den Submit-Guard. Gate-Tests setzen die
|
|
// Felder explizit auf null (siehe aiUndeclared()).
|
|
'ai_text_declaration' => AiTextDeclaration::None->value,
|
|
'ai_declaration_confirmed_at' => now(),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* PM ohne KI-Deklaration — zum Testen des Submit-Gates (Art. 50 KI-VO).
|
|
*/
|
|
public function aiUndeclared(): static
|
|
{
|
|
return $this->state([
|
|
'ai_text_declaration' => null,
|
|
'ai_declaration_confirmed_at' => null,
|
|
]);
|
|
}
|
|
|
|
public function published(): static
|
|
{
|
|
return $this->state([
|
|
'status' => PressReleaseStatus::Published->value,
|
|
'published_at' => now(),
|
|
]);
|
|
}
|
|
|
|
public function inReview(): static
|
|
{
|
|
return $this->state(['status' => PressReleaseStatus::Review->value]);
|
|
}
|
|
|
|
public function forPortal(Portal $portal): static
|
|
{
|
|
return $this->state(['portal' => $portal->value]);
|
|
}
|
|
}
|