<?php

namespace Database\Seeders;

use App\Models\Category;
use App\Models\Product;
use Illuminate\Database\Seeder;

class CategoryProductSeeder extends Seeder
{
    public function run(): void
    {
        $fruits = Category::create([
            'name' => 'Fruits',
            'slug' => 'fruits',
            'description' => 'Fruits frais',
            'is_active' => true,
            'sort_order' => 1,
        ]);
        $legumes = Category::create([
            'name' => 'Légumes',
            'slug' => 'legumes',
            'description' => 'Légumes frais',
            'is_active' => true,
            'sort_order' => 2,
        ]);
        $vivriers = Category::create([
            'name' => 'Vivriers',
            'slug' => 'vivriers',
            'description' => 'Produits vivriers',
            'is_active' => true,
            'sort_order' => 3,
        ]);

        Product::create([
            'category_id' => $fruits->id,
            'name' => 'Banane plantain',
            'slug' => 'banane-plantain',
            'description' => 'Banane plantain mûre',
            'price' => 500,
            'stock' => 100,
            'unit' => 'kg',
            'is_active' => true,
        ]);
        Product::create([
            'category_id' => $fruits->id,
            'name' => 'Orange',
            'slug' => 'orange',
            'description' => 'Orange fraîche',
            'price' => 300,
            'stock' => 50,
            'unit' => 'kg',
            'is_active' => true,
        ]);
        Product::create([
            'category_id' => $legumes->id,
            'name' => 'Tomate',
            'slug' => 'tomate',
            'description' => 'Tomate locale',
            'price' => 400,
            'stock' => 80,
            'unit' => 'kg',
            'is_active' => true,
        ]);
        Product::create([
            'category_id' => $legumes->id,
            'name' => 'Oignon',
            'slug' => 'oignon',
            'description' => 'Oignon sec',
            'price' => 600,
            'stock' => 60,
            'unit' => 'kg',
            'is_active' => true,
        ]);
        Product::create([
            'category_id' => $vivriers->id,
            'name' => 'Igname',
            'slug' => 'igname',
            'description' => 'Igname blanche',
            'price' => 450,
            'stock' => 40,
            'unit' => 'kg',
            'is_active' => true,
        ]);
    }
}
