<?php

namespace Database\Seeders;

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

class ShippingMethodSeeder extends Seeder
{
    public function run(): void
    {
        $methods = [
            ['name' => 'Colissimo (La Poste)', 'carrier' => 'colissimo', 'price' => 5.49, 'free_from' => 50, 'order' => 1],
            ['name' => 'Chronopost Express', 'carrier' => 'chronopost', 'price' => 16.00, 'order' => 2],
            ['name' => 'Mondial Relay (Point Relais)', 'carrier' => 'mondial_relay', 'price' => 4.50, 'free_from' => 80, 'order' => 3],
        ];

        foreach ($methods as $m) {
            ShippingMethod::firstOrCreate(
                ['carrier' => $m['carrier']],
                array_merge($m, ['is_active' => true])
            );
        }
    }
}
