<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class ProjectStatusSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $statuses = [
            [
                'name' => 'Pre-sales',
                'order' => 1,
                'is_active' => false,
                'is_billable' => false,
            ],
            [
                'name' => 'SOW Approval',
                'order' => 2,
                'is_active' => false,
                'is_billable' => false,
            ],
            [
                'name' => 'Estimation',
                'order' => 3,
                'is_active' => false,
                'is_billable' => false,
            ],
            [
                'name' => 'Estimate Approved',
                'order' => 4,
                'is_active' => false,
                'is_billable' => false,
            ],
            [
                'name' => 'Resource Allocation',
                'order' => 5,
                'is_active' => false,
                'is_billable' => false,
            ],
            [
                'name' => 'Sprint 0',
                'order' => 6,
                'is_active' => true,
                'is_billable' => false,
            ],
            [
                'name' => 'In Progress',
                'order' => 7,
                'is_active' => true,
                'is_billable' => true,
            ],
            [
                'name' => 'UAT',
                'order' => 8,
                'is_active' => true,
                'is_billable' => true,
            ],
            [
                'name' => 'Handover / Sign-off',
                'order' => 9,
                'is_active' => true,
                'is_billable' => true,
            ],
            [
                'name' => 'Estimate Rework',
                'order' => 10,
                'is_active' => false,
                'is_billable' => false,
            ],
            [
                'name' => 'On Hold',
                'order' => 11,
                'is_active' => false,
                'is_billable' => false,
            ],
            [
                'name' => 'Cancelled',
                'order' => 12,
                'is_active' => false,
                'is_billable' => false,
            ],
            [
                'name' => 'Closed',
                'order' => 13,
                'is_active' => false,
                'is_billable' => false,
            ],
        ];

        foreach ($statuses as $status) {
            DB::table('project_statuses')->updateOrInsert(
                ['name' => $status['name']],
                $status
            );
        }
    }
}
