<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

/**
 * The initial seed used Font Awesome 6 icon names; this ERP ships FA 5.15
 * (solid set only), so those icons rendered blank. Correct the system rows.
 */
class FixVaCareTaskIcons extends Migration
{
    public function up()
    {
        if (!Schema::hasTable('va_care_task_types')) return;

        $map = [
            'Feeding'           => 'fa-utensils',
            'Water / Hydration' => 'fa-tint',
            'Walk / Exercise'   => 'fa-walking',
            'Temperature Check' => 'fa-thermometer-half',
            'Weight Check'      => 'fa-weight',
            'Wound Dressing'    => 'fa-band-aid',
        ];

        foreach ($map as $name => $icon) {
            DB::table('va_care_task_types')
                ->whereNull('business_id')
                ->where('name', $name)
                ->update(['icon' => $icon]);
        }
    }

    public function down()
    {
        // No rollback — leaving valid icons in place is harmless.
    }
}
