<?php

namespace Database\Seeders;

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

class OrderChannelCatalogSeeder extends Seeder
{
    public function run(): void
    {
        $now = Carbon::now();
        $channels = [
            // id_order_channel, code, name
            [1, 'Web', 'Web'],
            [2, 'App', 'App'],
            [3, 'WhatsApp', 'WhatsApp'],
            [4, 'Telefono', 'Teléfono'],
            [5, 'Tienda', 'Tienda física'],
        ];

        foreach ($channels as [$id, $code, $name]) {
            DB::table('tbl_order_channels')->updateOrInsert(
                ['id_order_channel' => $id],
                [
                    'code' => $code,
                    'name' => $name,
                    'is_active' => true,
                    'created_at' => $now,
                    'updated_at' => $now,
                ]
            );
        }
    }
}
