<?php

namespace Database\Seeders;

use App\Models\Changelog;
use Illuminate\Database\Seeder;

class ChangelogSeeder extends Seeder
{
    public function run(): void
    {
        foreach ([
            ['title' => 'Company-code login', 'description' => 'Sign in with your company\'s code plus a username, instead of email — keeps every tenant\'s staff and data completely separate.', 'days_ago' => 10],
            ['title' => 'Multi-vehicle bookings', 'description' => 'Book several vehicle types in one trip (e.g. 2 Saloons + 1 Estate) from the dispatch console.', 'days_ago' => 9],
            ['title' => 'Role-based permissions', 'description' => 'Dispatcher and Company Admin roles now genuinely differ in what they can do — manage it under Organization → Roles.', 'days_ago' => 6],
            ['title' => 'Driver &amp; passenger ratings', 'description' => 'Both sides can now rate each other after a completed trip. Ratings show up on the Driver List.', 'days_ago' => 4],
            ['title' => 'Driver payouts', 'description' => 'Generate a payout for every driver\'s outstanding completed jobs, at their commission rate, from Drivers → Payouts.', 'days_ago' => 3],
            ['title' => 'Reports: exports &amp; driver performance', 'description' => 'Export any report range to CSV, and see per-driver completion/cancellation/rating breakdowns under Reports → Driver Performance.', 'days_ago' => 2],
            ['title' => 'Public marketing site', 'description' => 'A public homepage and "Request a Demo" page are now live, with leads landing under Growth → Demo Leads.', 'days_ago' => 1],
            ['title' => 'Help &amp; Support', 'description' => 'A searchable FAQ and a direct contact-support form are now available under System → Help & Support.', 'days_ago' => 0],
        ] as $entry) {
            Changelog::updateOrCreate(
                ['title' => $entry['title']],
                ['description' => $entry['description'], 'released_at' => now()->subDays($entry['days_ago'])]
            );
        }
    }
}
