<?php

namespace App\Database\Seeds;

use CodeIgniter\Database\Seeder;

class MainSeeder extends Seeder
{
    public function run()
    {
        // 1. Seed Admin User
        $db = \Config\Database::connect();
        $db->table('users')->truncate();
        
        $adminData = [
            'username'   => 'admin',
            'password'   => password_hash('admin123', PASSWORD_DEFAULT),
            'created_at' => date('Y-m-d H:i:s'),
        ];
        $db->table('users')->insert($adminData);

        // 2. Seed Default Gallery Items
        $db->table('gallery')->truncate();
        $galleryItems = [
            [
                'title'      => 'Royal Wedding Mandapam',
                'category'   => 'Decor',
                'image_path' => 'https://images.unsplash.com/photo-1519741497674-611481863552?q=80&w=800',
                'created_at' => date('Y-m-d H:i:s'),
            ],
            [
                'title'      => 'Traditional South Indian Feast',
                'category'   => 'Catering',
                'image_path' => 'https://images.unsplash.com/photo-1626132647523-66f5bf380027?q=80&w=800',
                'created_at' => date('Y-m-d H:i:s'),
            ],
            [
                'title'      => 'Auspicious Upanayanam Havan',
                'category'   => 'Ceremonies',
                'image_path' => 'https://images.unsplash.com/photo-1546833999-b9f581a1996d?q=80&w=800',
                'created_at' => date('Y-m-d H:i:s'),
            ],
            [
                'title'      => 'Marigold Torana Welcoming',
                'category'   => 'Decor',
                'image_path' => 'https://images.unsplash.com/photo-1583307130417-3346a1be7dee?q=80&w=800',
                'created_at' => date('Y-m-d H:i:s'),
            ],
            [
                'title'      => 'Traditional Jalebi & Laddu Platter',
                'category'   => 'Catering',
                'image_path' => 'https://images.unsplash.com/photo-1601050690597-df056fb4ce78?q=80&w=800',
                'created_at' => date('Y-m-d H:i:s'),
            ],
            [
                'title'      => 'Upanayanam Brahmopadesham',
                'category'   => 'Ceremonies',
                'image_path' => 'https://images.unsplash.com/photo-1609137144813-91b5c92c9066?q=80&w=800',
                'created_at' => date('Y-m-d H:i:s'),
            ],
            [
                'title'      => 'Kalyana Janavasam Stage',
                'category'   => 'Decor',
                'image_path' => 'https://images.unsplash.com/photo-1532712938310-34cb3982ef74?q=80&w=800',
                'created_at' => date('Y-m-d H:i:s'),
            ],
            [
                'title'      => 'Assorted Spiced Curries',
                'category'   => 'Catering',
                'image_path' => 'https://images.unsplash.com/photo-1589301760014-d929f3979dbc?q=80&w=800',
                'created_at' => date('Y-m-d H:i:s'),
            ],
            [
                'title'      => 'Auspicious Ganesha Pooja',
                'category'   => 'Ceremonies',
                'image_path' => 'https://images.unsplash.com/photo-1602751584552-8ba73aad10e1?q=80&w=800',
                'created_at' => date('Y-m-d H:i:s'),
            ],
        ];
        $db->table('gallery')->insertBatch($galleryItems);

        // 3. Seed Default Menu Packages (Breakfast, Lunch, Reception)
        $db->table('menu_packages')->truncate();
        $packages = [
            // --- Breakfast Category ---
            [
                'name'        => 'Breakfast Menu 1',
                'category'    => 'Breakfast',
                'price'       => 0.00,
                'description' => 'Traditional tiffin breakfast combo featuring soft idlis, Kichadi/Pongal and tiffin specialties.',
                'items'       => json_encode([
                    'Sweet',
                    'Idli',
                    'Vada',
                    'Kichadi / Pongal',
                    'Chutney',
                    'Sambar',
                    'Tea / Coffee'
                ]),
                'services'    => json_encode(['Paper Roll', 'Bio Paper Cups', 'Naakila (Traditional Banana Leaf)']),
                'created_at'  => date('Y-m-d H:i:s'),
            ],
            [
                'name'        => 'Breakfast Menu 2',
                'category'    => 'Breakfast',
                'price'       => 0.00,
                'description' => 'Sattvik breakfast combo featuring Appam/Noolputtu and stew with dosa items.',
                'items'       => json_encode([
                    'Sweet',
                    'Mysore Bonda / Vada',
                    'Appam / Noolputtu',
                    'Ishtu / Kadala Curry',
                    'Chutney (2 Types)',
                    'Dosa / Uthappam',
                    'Tea / Coffee'
                ]),
                'services'    => json_encode(['Paper Roll', 'Bio Paper Cups', 'Naakila (Traditional Banana Leaf)']),
                'created_at'  => date('Y-m-d H:i:s'),
            ],
            [
                'name'        => 'Breakfast Menu 3',
                'category'    => 'Breakfast',
                'price'       => 0.00,
                'description' => 'Grand traditional breakfast spread with mini idlis, seva, and poori masala.',
                'items'       => json_encode([
                    'Sweet',
                    'Mini Idli',
                    'Seva',
                    'Dosa / Masala Dosa',
                    'Chutney',
                    'Sambar',
                    'Poori Masala',
                    'Pongal',
                    'Gossu',
                    'Vada / Mysore Bonda',
                    'Tea / Coffee'
                ]),
                'services'    => json_encode(['Paper Roll', 'Bio Paper Cups', 'Naakila (Traditional Banana Leaf)']),
                'created_at'  => date('Y-m-d H:i:s'),
            ],
            [
                'name'        => 'Breakfast Menu 4',
                'category'    => 'Breakfast',
                'price'       => 0.00,
                'description' => 'Classic simple South Indian breakfast with soft idlis and crispy vada.',
                'items'       => json_encode([
                    'Sweet',
                    'Idli',
                    'Vada',
                    'Chutney',
                    'Sambar',
                    'Tea / Coffee'
                ]),
                'services'    => json_encode(['Paper Roll', 'Bio Paper Cups', 'Naakila (Traditional Banana Leaf)']),
                'created_at'  => date('Y-m-d H:i:s'),
            ],
            [
                'name'        => 'Breakfast Menu 5',
                'category'    => 'Breakfast',
                'price'       => 0.00,
                'description' => 'Traditional breakfast combo featuring seva, poori masala and Mysore bonda.',
                'items'       => json_encode([
                    'Sweet',
                    'Seva',
                    'Poori Masala',
                    'Mysore Bonda',
                    'Chutney',
                    'Tea / Coffee'
                ]),
                'services'    => json_encode(['Paper Roll', 'Bio Paper Cups', 'Naakila (Traditional Banana Leaf)']),
                'created_at'  => date('Y-m-d H:i:s'),
            ],
            [
                'name'        => 'Breakfast Menu 6',
                'category'    => 'Breakfast',
                'price'       => 0.00,
                'description' => 'Rich South Indian breakfast feast with puttu, poori masala and masala dosa.',
                'items'       => json_encode([
                    'Sweet',
                    'Mysore Bonda / Vada',
                    'Puttu / Kadala Curry',
                    'Poori Masala',
                    'Dosa / Masala Dosa',
                    'Chutney',
                    'Sambar',
                    'Tea / Coffee'
                ]),
                'services'    => json_encode(['Paper Roll', 'Bio Paper Cups', 'Naakila (Traditional Banana Leaf)']),
                'created_at'  => date('Y-m-d H:i:s'),
            ],

            // --- Lunch Category (Kerala Sadhyas) ---
            [
                'name'        => 'On Call Sadhya 1',
                'category'    => 'Lunch',
                'price'       => 0.00,
                'description' => 'Authentic traditional Kerala banana leaf lunch feast.',
                'items'       => json_encode([
                    'Pachadi', 
                    'Aviyal', 
                    'Kootu Curry', 
                    'Kaalan', 
                    'Olan', 
                    'Injipuli', 
                    'Mango Pickle', 
                    'Chips Sarkara Upperi', 
                    'Rice (Ponni)', 
                    'Sambar', 
                    'Rasam', 
                    'Pappadam', 
                    'Curd', 
                    'Palada Pradhaman'
                ]),
                'services'    => json_encode(['Paper Roll', 'Bio Paper Cups', 'Naakila', 'Drinking Water']),
                'created_at'  => date('Y-m-d H:i:s'),
            ],
            [
                'name'        => 'On Call Sadhya 2',
                'category'    => 'Lunch',
                'price'       => 0.00,
                'description' => 'Extended traditional Kerala lunch feast with tiffin starters & choices.',
                'items'       => json_encode([
                    'Pachadi', 
                    'Kichadi', 
                    'Aviyal', 
                    'Kootu Curry', 
                    'Kaalan or Masala Curry', 
                    'Olan or Ishtu', 
                    'Thoran', 
                    'Injipuli', 
                    'Mango Pickle', 
                    'Chips Sarkara Upperi', 
                    'Vada', 
                    'Rice (Ponni)', 
                    'Sambar', 
                    'Rasam', 
                    'Pappadam', 
                    'Curd', 
                    'Palada Payasam', 
                    'Paruppu', 
                    'Godhambu Payasam'
                ]),
                'services'    => json_encode([]),
                'created_at'  => date('Y-m-d H:i:s'),
            ],
            [
                'name'        => 'On Call Sadhya 3',
                'category'    => 'Lunch',
                'price'       => 0.00,
                'description' => 'Premium royal Kerala lunch feast with appetizers, Boli & multiple payasams.',
                'items'       => json_encode([
                    'Pachadi', 
                    'Kichadi', 
                    'Aviyal', 
                    'Kootu Curry', 
                    'Kaalan', 
                    'Olan', 
                    'Thoran', 
                    'Masala Curry or Chena Cutlet', 
                    'Injipuli', 
                    'Mango Pickle', 
                    'Chips Sarkara Upperi', 
                    'Vada', 
                    'Boli', 
                    'Rice (Ponni)', 
                    'Sambar', 
                    'Mor Kuzhambu or Kaara Kozhambu', 
                    'Rasam', 
                    'Pappadam', 
                    'Curd', 
                    'Palada Payasam', 
                    'Godhambu or Paruppu Payasam'
                ]),
                'services'    => json_encode(['Paper Roll', 'Bio Paper Cups', 'Naakila', 'Bottle Water']),
                'created_at'  => date('Y-m-d H:i:s'),
            ],
            [
                'name'        => 'On Call Sadhya 4',
                'category'    => 'Lunch',
                'price'       => 0.00,
                'description' => 'Ultimate grand royal lunch feast featuring Chapathi/Biriyani, special pradhamans and Beeda.',
                'items'       => json_encode([
                    'Pachadi', 
                    'Kichadi', 
                    'Aviyal', 
                    'Kootu Curry', 
                    'Kaalan', 
                    'Olan', 
                    'Ishtu', 
                    'Thoran', 
                    'Masala Curry or Chena Cutlet', 
                    'Injipuli', 
                    'Mango Pickle', 
                    'Chips Sarkara Upperi', 
                    'Vada', 
                    'Boli', 
                    'Chapathi with Curry or Biriyani with Salad & Pickle', 
                    'Rice (Ponni)', 
                    'Sambar', 
                    'Mor Kuzhambu or Kaara Kozhambu', 
                    'Rasam', 
                    'Pappadam', 
                    'Curd', 
                    'Palada Payasam', 
                    'Chakka Pradhaman or Pazham Pradhaman', 
                    'Beeda'
                ]),
                'services'    => json_encode(['Paper Roll', 'Naakila', 'Bottle Water']),
                'created_at'  => date('Y-m-d H:i:s'),
            ],

            // --- Reception Category ---
            [
                'name'        => 'Grand Reception Feast',
                'category'    => 'Reception',
                'price'       => 0.00,
                'description' => 'Ultimate grand royal reception feast with live mocked counters, Chinese stations, special counter and live tiffin.',
                'items'       => json_encode([
                    'Welcome Drink (Live Fresh Juice)',
                    'Chat Counter',
                    'Variety Starters',
                    'Variety Rotti',
                    'Paneer Butter Masala',
                    'Veg. Jalfrezi',
                    'Veg. Kofta',
                    'Kashmiri Pulav / Hyderabad Biriyani',
                    'Salad',
                    'Pickle',
                    'Green Salad',
                    'Chilly Gobi / Fried Vegetables',
                    'Live Appam',
                    'Live Idiappam',
                    'Live Puttu',
                    'Ishtu',
                    'Kadala Curry',
                    'Variety Dosa',
                    'Chutney',
                    'Sambar',
                    'Gulab Jamun',
                    'Rasamalai',
                    'Variety Ice Cream',
                    'Popcorn',
                    'Candy',
                    'Variety Beeda',
                    'Nadan Thattukada',
                    'Noodles',
                    'Fried Rice',
                    'Gobi Manjurian'
                ]),
                'services'    => json_encode(['Paper Roll', 'Naakila (Banana Leaf)', 'Premium Uniformed Servers', 'Welcome Drink Counter']),
                'created_at'  => date('Y-m-d H:i:s'),
            ],
            [
                'name'        => 'Reception Menu 1',
                'category'    => 'Reception',
                'price'       => 0.00,
                'description' => 'Traditional wedding reception feast with hot parottas, pulav and sweet payasams.',
                'items'       => json_encode([
                    'Welcome Drink',
                    'Sweet',
                    'Chappathi / Parotta',
                    'Veg. Kuruma',
                    'Pulav / Biriyani',
                    'Salad',
                    'Pickle',
                    'Chilly Gobi',
                    'Dosa',
                    'Chutney',
                    'Sambar',
                    'Ice Cream'
                ]),
                'services'    => json_encode(['Paper Roll', 'Naakila (Banana Leaf)', 'Uniformed Servers']),
                'created_at'  => date('Y-m-d H:i:s'),
            ],
            [
                'name'        => 'Reception Menu 2',
                'category'    => 'Reception',
                'price'       => 0.00,
                'description' => 'Extended reception spread featuring starters, rumali rotti, paneer butter masala and desserts.',
                'items'       => json_encode([
                    'Welcome Drink',
                    'Starters',
                    'Sweet',
                    'Rumali Rotti',
                    'Paneer Butter Masala',
                    'Pulav / Biriyani',
                    'Salad',
                    'Pickle',
                    'Chilly Gobi / Fried Veg.',
                    'Dosa / Masala Dosa',
                    'Chutney',
                    'Sambar',
                    'Gulab Jamun',
                    'Ice Cream',
                    'Beeda'
                ]),
                'services'    => json_encode(['Paper Roll', 'Naakila (Banana Leaf)', 'Uniformed Servers']),
                'created_at'  => date('Y-m-d H:i:s'),
            ],
            [
                'name'        => 'Reception Menu 3',
                'category'    => 'Reception',
                'price'       => 0.00,
                'description' => 'Classic mini reception menu with sweets, tiffin sides and traditional paan.',
                'items'       => json_encode([
                    'Chutney',
                    'Sambar',
                    'Gulab Jamun',
                    'Carrot Halwa',
                    'Ice Cream',
                    'Beeda'
                ]),
                'services'    => json_encode(['Paper Roll', 'Naakila (Banana Leaf)', 'Uniformed Servers']),
                'created_at'  => date('Y-m-d H:i:s'),
            ],
            [
                'name'        => 'Reception Menu 4',
                'category'    => 'Reception',
                'price'       => 0.00,
                'description' => 'Comforting reception menu featuring appam, idiappam and hot curries.',
                'items'       => json_encode([
                    'Welcome Drink',
                    'Sweet',
                    'Chappathi / Parotta',
                    'Veg. Kuruma',
                    'Pulav / Biriyani',
                    'Salad',
                    'Pickle',
                    'Chilly Gobi / Fried Veg.',
                    'Appam / Idiappam',
                    'Ishtu / Kadala Curry',
                    'Dosa',
                    'Chutney',
                    'Sambar',
                    'Ice Cream'
                ]),
                'services'    => json_encode(['Paper Roll', 'Naakila (Banana Leaf)', 'Uniformed Servers']),
                'created_at'  => date('Y-m-d H:i:s'),
            ],
            [
                'name'        => 'Reception Menu 5',
                'category'    => 'Reception',
                'price'       => 0.00,
                'description' => 'Grand reception menu with live appam/idiappam counters and paneer dishes.',
                'items'       => json_encode([
                    'Welcome Drink',
                    'Starters',
                    'Sweet',
                    'Rumali Rotti',
                    'Alu Parotta',
                    'Paneer Butter Masala',
                    'Kadai Veg.',
                    'Pulav / Biriyani',
                    'Salad',
                    'Pickle',
                    'Chilly Gobi / Fried Veg.',
                    'Appam / Idiappam (Live)',
                    'Dosa / Masala Dosa'
                ]),
                'services'    => json_encode(['Paper Roll', 'Naakila (Banana Leaf)', 'Uniformed Servers']),
                'created_at'  => date('Y-m-d H:i:s'),
            ],
            [
                'name'        => 'Reception Menu 6',
                'category'    => 'Reception',
                'price'       => 0.00,
                'description' => 'Elite reception spread with live stations, mocktail drinks, and extensive sweet assortments.',
                'items'       => json_encode([
                    'Welcome Drink',
                    'Chat Counter',
                    'Starters',
                    'Sweet',
                    'Rumali Rotti / Alu Parotta',
                    'Paneer Butter Masala / Kadai Veg.',
                    'Pulav / Hyderabad Biriyani',
                    'Salad',
                    'Pickle',
                    'Chilly Gobi / Fried Veg.',
                    'Appam / Idiappam / Puttu (Live)',
                    'Ishtu / Kadala Curry',
                    'Dosa / Masala Dosa',
                    'Chutney',
                    'Sambar',
                    'Green Salad',
                    'Gulab Jamun / Rasamalai',
                    'Carrot Halwa',
                    'Ice Cream'
                ]),
                'services'    => json_encode(['Paper Roll', 'Naakila (Banana Leaf)', 'Premium Uniformed Servers', 'Premium Bottle Water']),
                'created_at'  => date('Y-m-d H:i:s'),
            ],
        ];
        $db->table('menu_packages')->insertBatch($packages);
    }
}
