<?php

namespace Database\Seeders;

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

class MenuSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        // Create admin user
        User::create([
            'name' => 'Admin',
            'email' => 'admin@menuqr.com',
            'password' => Hash::make('password'),
            'role' => 'admin',
        ]);

        // Create sample user
        User::create([
            'name' => 'User',
            'email' => 'user@menuqr.com',
            'password' => Hash::make('password'),
            'role' => 'user',
        ]);

        // Create categories
        $makanan = Category::create([
            'name' => 'Makanan',
            'description' => 'Berbagai pilihan makanan',
        ]);

        $minuman = Category::create([
            'name' => 'Minuman',
            'description' => 'Berbagai pilihan minuman',
        ]);

        $snack = Category::create([
            'name' => 'Snack',
            'description' => 'Camilan ringan',
        ]);

        // Create menus for Makanan
        Menu::create([
            'category_id' => $makanan->id,
            'name' => 'Nasi Goreng',
            'description' => 'Nasi goreng khas dengan telur, ayam, dan kerupuk',
            'price' => 25000,
            'is_available' => true,
        ]);

        Menu::create([
            'category_id' => $makanan->id,
            'name' => 'Mie Goreng',
            'description' => 'Mie goreng dengan telur dan sayuran',
            'price' => 20000,
            'is_available' => true,
        ]);

        Menu::create([
            'category_id' => $makanan->id,
            'name' => 'Ayam Goreng',
            'description' => 'Ayam goreng crispy dengan nasi putih',
            'price' => 22000,
            'is_available' => true,
        ]);

        Menu::create([
            'category_id' => $makanan->id,
            'name' => 'Sate Ayam',
            'description' => 'Sate ayam dengan bumbu kacang',
            'price' => 30000,
            'is_available' => true,
        ]);

        // Create menus for Minuman
        Menu::create([
            'category_id' => $minuman->id,
            'name' => 'Es Teh',
            'description' => 'Teh manis dingin',
            'price' => 5000,
            'is_available' => true,
        ]);

        Menu::create([
            'category_id' => $minuman->id,
            'name' => 'Kopi Hitam',
            'description' => 'Kopi tanpa gula',
            'price' => 8000,
            'is_available' => true,
        ]);

        Menu::create([
            'category_id' => $minuman->id,
            'name' => 'Jus Alpukat',
            'description' => 'Jus alpukat segar dengan susu',
            'price' => 15000,
            'is_available' => true,
        ]);

        Menu::create([
            'category_id' => $minuman->id,
            'name' => 'Es Jeruk',
            'description' => 'Jeruk segar dingin',
            'price' => 10000,
            'is_available' => true,
        ]);

        // Create menus for Snack
        Menu::create([
            'category_id' => $snack->id,
            'name' => 'Kentang Goreng',
            'description' => 'Kentang goreng crispy',
            'price' => 12000,
            'is_available' => true,
        ]);

        Menu::create([
            'category_id' => $snack->id,
            'name' => 'Chicken Nugget',
            'description' => 'Nugget ayam dengan saos',
            'price' => 15000,
            'is_available' => true,
        ]);

        Menu::create([
            'category_id' => $snack->id,
            'name' => 'Pisang Goreng',
            'description' => 'Pisang goreng crispy',
            'price' => 8000,
            'is_available' => true,
        ]);
    }
}
