<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use App\Models\Setting;
use App\Models\User;
use Illuminate\Support\Facades\Hash;

class SettingsSeeder extends Seeder
{
    public function run(): void
    {
        Setting::updateOrCreate(
            ['key' => 'subscription_price'],
            ['value' => '10000', 'type' => 'number', 'description' => 'Prix de l\'abonnement']
        );
        Setting::updateOrCreate(
            ['key' => 'minimum_monthly_purchase'],
            ['value' => '25000', 'type' => 'number', 'description' => 'Montant d\'achat mensuel obligatoire']
        );
        Setting::updateOrCreate(
            ['key' => 'level_1_commission'],
            ['value' => '10', 'type' => 'number', 'description' => 'Commission niveau 1 (%)']
        );
        Setting::updateOrCreate(
            ['key' => 'level_2_commission'],
            ['value' => '5', 'type' => 'number', 'description' => 'Commission niveau 2 (%)']
        );
        Setting::updateOrCreate(
            ['key' => 'quick_start_bonus'],
            ['value' => '5000', 'type' => 'number', 'description' => 'Bonus de démarrage rapide']
        );
        Setting::updateOrCreate(
            ['key' => 'member_discount_percentage'],
            ['value' => '15', 'type' => 'number', 'description' => 'Réduction membre (%)']
        );

        User::updateOrCreate(
            ['email' => 'admin@bijouexpress.com'],
            [
                'name' => 'Admin Bijou Express',
                'password' => Hash::make('admin123'),
                'member_code' => 'ADM1000',
                'role' => 'admin',
                'is_active' => true,
                'subscription_paid' => true,
                'first_purchase_done' => true
            ]
        );
    }
}
