<?php

declare(strict_types=1);

use App\Models\World;
use Database\Seeders\WorldLaunchSeeder;

it('seeds a live Spring Vibes activation and recurring archive editions', function (): void {
    $this->seed(WorldLaunchSeeder::class);

    $springVibes = World::query()
        ->where('slug', 'like', 'spring-vibes-%')
        ->campaignActive()
        ->where('is_homepage_featured', true)
        ->first();

    expect($springVibes)->not->toBeNull();
    expect($springVibes?->title)->toStartWith('Spring Vibes');
    expect($springVibes?->worldRelations()->count())->toBeGreaterThan(0);
    expect($springVibes?->campaign_priority)->toBeGreaterThan(0);
    expect($springVibes?->teaser_title)->toBe('Now live: Spring Vibes');

    $archivedEdition = World::query()
        ->where('parent_world_id', $springVibes?->id)
        ->where('status', World::STATUS_ARCHIVED)
        ->first();

    $upcomingCampaign = World::query()
        ->where('slug', 'like', 'pixel-week-%')
        ->first();

    expect($archivedEdition)->not->toBeNull();
    expect($upcomingCampaign)->not->toBeNull();
    expect($upcomingCampaign?->is_active_campaign)->toBeTrue();
    expect($upcomingCampaign?->promotion_starts_at)->not->toBeNull();
    expect(World::query()->count())->toBeGreaterThanOrEqual(8);
});