<?php

namespace Database\Seeders;

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

class MenuSeeder extends Seeder
{
    public function run()
    {
        // Insert categories first
        $categories = [
            ['name' => 'Makanan', 'created_at' => now(), 'updated_at' => now()],
            ['name' => 'Minuman', 'created_at' => now(), 'updated_at' => now()],
            ['name' => 'Cemilan', 'created_at' => now(), 'updated_at' => now()],
        ];

        DB::table('menu_categories')->insert($categories);

        // Get category IDs
        $foodId = DB::table('menu_categories')->where('name', 'Makanan')->first()->id;
        $drinkId = DB::table('menu_categories')->where('name', 'Minuman')->first()->id;
        $snackId = DB::table('menu_categories')->where('name', 'Cemilan')->first()->id;

        // Insert menu items
        DB::table('menu_items')->insert([
            // Menu Makanan
            [
                'name' => 'Nasi Goreng Special',
                'price' => 22000,
                'description' => 'Nasi goreng dengan telur, ayam, dan sayuran segar',
                'category_id' => $foodId,
                'image' => '/images/Nasi Goreng.jpg',
                'is_available' => true,
                'created_at' => now(),
                'updated_at' => now()
            ],
            [
                'name' => 'Ayam Geprek',
                'price' => 18000,
                'description' => 'Ayam crispy geprek dengan sambal pedas',
                'category_id' => $foodId,
                'image' => '/images/Ayam Geprek.jpg',
                'is_available' => true,
                'created_at' => now(),
                'updated_at' => now()
            ],
            [
                'name' => 'Mie Goreng',
                'price' => 18000,
                'description' => 'Mie goreng dengan perpaduan rasa yang manis',
                'category_id' => $foodId,
                'image' => '/images/Mie Goreng.jpg',
                'is_available' => true,
                'created_at' => now(),
                'updated_at' => now()
            ],
            [
                'name' => 'Spaghetti',
                'price' => 25000,
                'description' => 'Spaghetti dengan campuran saus bolognese dan daging sapi',
                'category_id' => $foodId,
                'image' => '/images/Spaghetti.jpg',
                'is_available' => true,
                'created_at' => now(),
                'updated_at' => now()
            ],
            // Menu Minuman
            [
                'name' => 'Lemon Tea',
                'price' => 12000,
                'description' => 'Es teh dengan perpaduan lemon yang segar',
                'category_id' => $drinkId,
                'image' => '/images/Lemon Tea.jpg',
                'is_available' => true,
                'created_at' => now(),
                'updated_at' => now()
            ],
            [
                'name' => 'Kopi Susu',
                'price' => 12000,
                'description' => 'Kopi dengan campuran susu yang nikmat',
                'category_id' => $drinkId,
                'image' => '/images/Kopi Susu.jpg',
                'is_available' => true,
                'created_at' => now(),
                'updated_at' => now()
            ],
            [
                'name' => 'Es Jeruk',
                'price' => 8000,
                'description' => 'Es jeruk dengan perasan jeruk yang segar',
                'category_id' => $drinkId,
                'image' => '/images/Es Jeruk.jpg',
                'is_available' => true,
                'created_at' => now(),
                'updated_at' => now()
            ],
            [
                'name' => 'Es Cincau',
                'price' => 10000,
                'description' => 'Es cincau dengan campuran cincau dan sirup',
                'category_id' => $drinkId,
                'image' => '/images/Es Cincau.jpg',
                'is_available' => true,
                'created_at' => now(),
                'updated_at' => now()
            ],
            // Menu Cemilan
            [
                'name' => 'Kentang Goreng',
                'price' => 15000,
                'description' => 'Kentang goreng crispy dengan saus special',
                'category_id' => $snackId,
                'image' => '/images/Kentang Goreng.jpg',
                'is_available' => true,
                'created_at' => now(),
                'updated_at' => now()
            ],
            [
                'name' => 'Roti Bakar',
                'price' => 12000,
                'description' => 'Roti bakar dengan tambahan selai coklat, strawberry, dan blueberry',
                'category_id' => $snackId,
                'image' => '/images/Roti Bakar.jpg',
                'is_available' => true,
                'created_at' => now(),
                'updated_at' => now()
            ],
            [
                'name' => 'Mix Platter',
                'price' => 18000,
                'description' => 'Snack dengan isian nugget, sosis, dan kentang',
                'category_id' => $snackId,
                'image' => '/images/Mix Platter.jpg',
                'is_available' => true,
                'created_at' => now(),
                'updated_at' => now()
            ],
            [
                'name' => 'Churros',
                'price' => 15000,
                'description' => 'Churros dengan tambahan selai coklat, matcha, dan taro',
                'category_id' => $snackId,
                'image' => '/images/Churros.jpg',
                'is_available' => true,
                'created_at' => now(),
                'updated_at' => now()
            ],
        ]);
    }
}