Files
crewli/api/database/factories/ArtistEngagementFactory.php
bert.hausmans 3e3636dc53 feat(timetable): factories + ArtistTimetableDevSeeder
Eight factories with named states (Genre, Artist, ArtistContact, Stage,
ArtistEngagement, Performance, AdvanceSection, AdvanceSubmission).

ArtistTimetableDevSeeder hooked into DevSeeder::seedEchtFeesten after
the form-builder showcase. Produces:
- 4 stages (Mainstage, Havana, Stairway, Socialite) with prototype-style
  hex colours
- 4 stages × 3 sub-events = 12 stage_days rows
- 4 genres (Hardstyle, Techno, Indie, Live band)
- 6 master artists, each with one tour-manager ArtistContact
- 12 engagements with status mix (1 Draft, 2 Requested, 3 Option,
  2 Confirmed, 3 Contracted, 1 Cancelled). Two artists have two
  engagements each (different sub-events) — exercises D17 multi-
  engagement-per-artist.
- 13 performances, including one parked (stage_id=null = wachtrij)
  and one B2B pair within 3 minutes on Mainstage Saturday to seed
  the Session 4 frontend B2B detector.

Also fix LogOptions method name across 8 models: dontSubmitEmptyLogs()
→ dontLogEmptyChanges() (Spatie's actual API; surfaced when DevSeeder
ran).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 18:08:16 +02:00

85 lines
2.5 KiB
PHP

<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Enums\Artist\ArtistEngagementStatus;
use App\Models\Artist;
use App\Models\ArtistEngagement;
use App\Models\Event;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/** @extends Factory<ArtistEngagement> */
final class ArtistEngagementFactory extends Factory
{
/** @return array<string, mixed> */
public function definition(): array
{
return [
// organisation_id is set by the observer from the artist;
// factory leaves it null and lets the observer denormalise.
'artist_id' => Artist::factory(),
'event_id' => Event::factory(),
'booking_status' => ArtistEngagementStatus::Draft,
'fee_currency' => 'EUR',
'buma_applicable' => true,
'buma_percentage' => 7.00,
'buma_handled_by' => 'organisation',
'vat_applicable' => true,
'vat_percentage' => 21.00,
'payment_status' => 'none',
'crew_count' => 0,
'guests_count' => 0,
'advancing_completed_count' => 0,
'advancing_total_count' => 0,
];
}
public function draft(): static
{
return $this->state(fn () => ['booking_status' => ArtistEngagementStatus::Draft]);
}
public function requested(): static
{
return $this->state(fn () => [
'booking_status' => ArtistEngagementStatus::Requested,
'requested_at' => now(),
]);
}
public function option(): static
{
return $this->state(fn () => [
'booking_status' => ArtistEngagementStatus::Option,
'option_expires_at' => now()->addDays(14),
]);
}
public function offered(): static
{
return $this->state(fn () => ['booking_status' => ArtistEngagementStatus::Offered]);
}
public function confirmed(): static
{
return $this->state(fn () => ['booking_status' => ArtistEngagementStatus::Confirmed]);
}
public function contracted(): static
{
return $this->state(fn () => [
'booking_status' => ArtistEngagementStatus::Contracted,
'fee_amount' => fake()->randomFloat(2, 500, 25000),
'portal_token' => (string) Str::ulid(),
]);
}
public function cancelled(): static
{
return $this->state(fn () => ['booking_status' => ArtistEngagementStatus::Cancelled]);
}
}