-- ============================================
-- Stocks Coffee - Seed Data
-- Initial data for testing and development
-- ============================================


-- ============================================
-- ROLES
-- ============================================
INSERT INTO `roles` (`name`, `slug`, `description`, `level`, `is_active`) VALUES
('Super Admin', 'super_admin', 'Full system access', 100, 1),
('Admin', 'admin', 'Administrative access', 80, 1),
('Cashier', 'cashier', 'Manage payments and orders', 50, 1),
('Barista', 'barista', 'View and process orders', 40, 1),
('Customer', 'customer', 'Regular customer', 10, 1);

-- ============================================
-- PERMISSIONS
-- ============================================
INSERT INTO `permissions` (`name`, `slug`, `module`, `action`, `description`) VALUES
('Dashboard View', 'dashboard.view', 'dashboard', 'view', 'View analytics dashboard'),
('Order List', 'orders.list', 'orders', 'list', 'View orders list'),
('Order Create', 'orders.create', 'orders', 'create', 'Create new orders'),
('Order Update', 'orders.update', 'orders', 'update', 'Update order status'),
('Order Delete', 'orders.delete', 'orders', 'delete', 'Cancel/delete orders'),
('Product List', 'products.list', 'products', 'list', 'View products'),
('Product Create', 'products.create', 'products', 'create', 'Create products'),
('Product Update', 'products.update', 'products', 'update', 'Edit products'),
('Product Delete', 'products.delete', 'products', 'delete', 'Delete products'),
('Category List', 'categories.list', 'categories', 'list', 'View categories'),
('Category Create', 'categories.create', 'categories', 'create', 'Create categories'),
('Category Update', 'categories.update', 'categories', 'update', 'Edit categories'),
('Category Delete', 'categories.delete', 'categories', 'delete', 'Delete categories'),
('Voucher List', 'vouchers.list', 'vouchers', 'list', 'View vouchers'),
('Voucher Create', 'vouchers.create', 'vouchers', 'create', 'Create vouchers'),
('Voucher Update', 'vouchers.update', 'vouchers', 'update', 'Edit vouchers'),
('Voucher Delete', 'vouchers.delete', 'vouchers', 'delete', 'Delete vouchers'),
('Payment List', 'payments.list', 'payments', 'list', 'View payments'),
('Payment Process', 'payments.process', 'payments', 'process', 'Process payments'),
('Payment Refund', 'payments.refund', 'payments', 'refund', 'Refund payments'),
('Customer List', 'customers.list', 'customers', 'list', 'View customers'),
('Customer Update', 'customers.update', 'customers', 'update', 'Edit customers'),
('Staff List', 'staff.list', 'staff', 'list', 'View staff'),
('Staff Create', 'staff.create', 'staff', 'create', 'Create staff accounts'),
('Staff Update', 'staff.update', 'staff', 'update', 'Edit staff'),
('Staff Delete', 'staff.delete', 'staff', 'delete', 'Delete staff'),
('Chat Manage', 'chat.manage', 'chat', 'manage', 'Manage live chat'),
('Analytics View', 'analytics.view', 'analytics', 'view', 'View analytics'),
('Report Export', 'reports.export', 'reports', 'export', 'Export reports'),
('Settings Manage', 'settings.manage', 'settings', 'manage', 'Manage settings'),
('Role Manage', 'roles.manage', 'roles', 'manage', 'Manage roles');

-- ============================================
-- ROLE PERMISSIONS (Super Admin gets all)
-- ============================================
INSERT INTO `role_permissions` (`role_id`, `permission_id`)
SELECT 1, id FROM permissions;

-- Admin permissions
INSERT INTO `role_permissions` (`role_id`, `permission_id`) VALUES
(2, 1), (2, 2), (2, 3), (2, 4), (2, 5),
(2, 6), (2, 7), (2, 8), (2, 9),
(2, 10), (2, 11), (2, 12), (2, 13),
(2, 14), (2, 15), (2, 16), (2, 17),
(2, 18), (2, 19), (2, 20),
(2, 21), (2, 22), (2, 23), (2, 24), (2, 25),
(2, 27), (2, 28), (2, 29);

-- Cashier permissions
INSERT INTO `role_permissions` (`role_id`, `permission_id`) VALUES
(3, 1), (3, 2), (3, 3), (3, 4),
(3, 18), (3, 19),
(3, 21), (3, 22),
(3, 27);

-- Barista permissions
INSERT INTO `role_permissions` (`role_id`, `permission_id`) VALUES
(4, 2), (4, 4);

-- ============================================
-- DEFAULT ADMIN USER (password: Admin@123)
-- ============================================
INSERT INTO `users` (`role_id`, `full_name`, `email`, `phone`, `password`, `email_verified_at`, `phone_verified_at`, `is_active`) VALUES
(1, 'Super Administrator', 'admin@stockscoffee.com', '081234567890', '$2y$12$LQv3c1yqBWVHxkd0LHAkCOYz6TtxMQJqhN8/X4.VTtYA.qGZvKG6G', NOW(), NOW(), 1);
-- Password hash for: Admin@123

-- ============================================
-- CATEGORIES
-- ============================================
INSERT INTO `categories` (`name`, `slug`, `description`, `icon`, `sort_order`, `is_active`) VALUES
('Coffee', 'coffee', 'Premium coffee selections from around the world', 'bx-coffee', 1, 1),
('Non-Coffee', 'non-coffee', 'Refreshing non-coffee beverages', 'bx-drink', 2, 1),
('Tea', 'tea', 'Fine selection of teas', 'bx-leaf', 3, 1),
('Main Course', 'main-course', 'Delicious main dishes and meals', 'bx-restaurant', 4, 1),
('Snacks', 'snacks', 'Light bites and pastries', 'bx-cookie', 5, 1);

-- ============================================
-- PRODUCTS - COFFEE
-- ============================================
INSERT INTO `products` (`category_id`, `name`, `slug`, `description`, `ingredients`, `price_normal`, `price_large`, `cost_price`, `is_available`, `is_featured`, `preparation_time`, `sort_order`) VALUES
(1, 'Espresso', 'espresso', 'Rich and bold single shot of premium espresso', 'Arabica coffee beans', 18000, NULL, 8000, 1, 0, 5, 1),
(1, 'Americano', 'americano', 'Smooth espresso diluted with hot water', 'Espresso, hot water', 22000, 28000, 10000, 1, 0, 5, 2),
(1, 'Cappuccino', 'cappuccino', 'Perfect balance of espresso, steamed milk, and foam', 'Espresso, steamed milk, milk foam', 28000, 35000, 12000, 1, 1, 8, 3),
(1, 'Latte', 'cafe-latte', 'Creamy espresso with steamed milk', 'Espresso, steamed milk, microfoam', 28000, 35000, 12000, 1, 1, 8, 4),
(1, 'Mocha', 'cafe-mocha', 'Chocolate-infused coffee delight', 'Espresso, chocolate syrup, steamed milk, whipped cream', 32000, 40000, 15000, 1, 1, 10, 5),
(1, 'Caramel Macchiato', 'caramel-macchiato', 'Espresso with vanilla and caramel', 'Espresso, vanilla syrup, steamed milk, caramel drizzle', 35000, 42000, 16000, 1, 0, 10, 6),
(1, 'Cold Brew', 'cold-brew', '12-hour steeped cold coffee', 'Coarse ground Arabica, cold water', 25000, 32000, 10000, 1, 1, 3, 7),
(1, 'Vietnamese Coffee', 'vietnamese-coffee', 'Strong coffee with condensed milk', 'Robusta coffee, condensed milk', 24000, 30000, 10000, 1, 0, 8, 8);

-- ============================================
-- PRODUCTS - NON-COFFEE
-- ============================================
INSERT INTO `products` (`category_id`, `name`, `slug`, `description`, `ingredients`, `price_normal`, `price_large`, `cost_price`, `is_available`, `is_featured`, `preparation_time`, `sort_order`) VALUES
(2, 'Chocolate', 'hot-chocolate', 'Rich and creamy hot chocolate', 'Cocoa powder, milk, whipped cream', 28000, 35000, 12000, 1, 0, 8, 1),
(2, 'Matcha Latte', 'matcha-latte', 'Japanese green tea latte', 'Matcha powder, steamed milk', 32000, 40000, 14000, 1, 1, 10, 2),
(2, 'Red Velvet Latte', 'red-velvet-latte', 'Creamy red velvet flavored milk', 'Red velvet syrup, steamed milk', 30000, 38000, 13000, 1, 0, 8, 3),
(2, 'Milkshake Vanilla', 'vanilla-milkshake', 'Classic vanilla milkshake', 'Vanilla ice cream, milk', 25000, 32000, 10000, 1, 0, 5, 4),
(2, 'Milkshake Chocolate', 'chocolate-milkshake', 'Rich chocolate milkshake', 'Chocolate ice cream, milk, chocolate syrup', 28000, 35000, 12000, 1, 0, 5, 5),
(2, 'Lemonade', 'fresh-lemonade', 'Refreshing fresh lemonade', 'Fresh lemon, sugar, water, mint', 18000, 24000, 6000, 1, 0, 5, 6);

-- ============================================
-- PRODUCTS - TEA
-- ============================================
INSERT INTO `products` (`category_id`, `name`, `slug`, `description`, `ingredients`, `price_normal`, `price_large`, `cost_price`, `is_available`, `is_featured`, `preparation_time`, `sort_order`) VALUES
(3, 'Earl Grey', 'earl-grey-tea', 'Classic bergamot-flavored black tea', 'Black tea, bergamot oil', 20000, 26000, 8000, 1, 0, 7, 1),
(3, 'Jasmine Tea', 'jasmine-tea', 'Fragrant jasmine green tea', 'Green tea, jasmine flowers', 20000, 26000, 8000, 1, 0, 7, 2),
(3, ' Chamomile', 'chamomile-tea', 'Soothing caffeine-free chamomile', 'Chamomile flowers', 22000, 28000, 9000, 1, 0, 7, 3),
(3, 'Thai Milk Tea', 'thai-milk-tea', 'Sweet and creamy Thai tea', 'Thai tea mix, condensed milk, sugar', 24000, 30000, 9000, 1, 1, 10, 4),
(3, 'Lychee Tea', 'lychee-tea', 'Refreshing lychee iced tea', 'Black tea, lychee syrup, lychee fruit', 22000, 28000, 8000, 1, 0, 7, 5);

-- ============================================
-- PRODUCTS - MAIN COURSE
-- ============================================
INSERT INTO `products` (`category_id`, `name`, `slug`, `description`, `ingredients`, `price_normal`, `price_large`, `cost_price`, `is_available`, `is_featured`, `preparation_time`, `sort_order`) VALUES
(4, 'Chicken Sandwich', 'chicken-sandwich', 'Grilled chicken with fresh vegetables', 'Chicken breast, lettuce, tomato, mayo, ciabatta', 35000, NULL, 15000, 1, 1, 15, 1),
(4, 'Beef Burger', 'classic-beef-burger', 'Juicy beef patty with cheese', 'Beef patty, cheddar cheese, lettuce, tomato, brioche bun', 45000, NULL, 20000, 1, 1, 18, 2),
(4, 'Tuna Melt', 'tuna-melt-panini', 'Tuna and cheese grilled panini', 'Tuna, mozzarella, onion, celery, sourdough', 38000, NULL, 16000, 1, 0, 15, 3),
(4, 'Pasta Carbonara', 'pasta-carbonara', 'Creamy Italian carbonara', 'Spaghetti, egg, parmesan, bacon, black pepper', 42000, NULL, 18000, 1, 0, 20, 4),
(4, 'Nasi Goreng', 'nasi-goreng-special', 'Indonesian special fried rice', 'Rice, chicken, shrimp, egg, kecap manis', 38000, NULL, 16000, 1, 1, 18, 5);

-- ============================================
-- PRODUCTS - SNACKS
-- ============================================
INSERT INTO `products` (`category_id`, `name`, `slug`, `description`, `ingredients`, `price_normal`, `price_large`, `cost_price`, `is_available`, `is_featured`, `preparation_time`, `sort_order`) VALUES
(5, 'Croissant', 'butter-croissant', 'Flaky French butter croissant', 'Flour, butter, yeast, sugar', 18000, NULL, 7000, 1, 1, 3, 1),
(5, 'Chocolate Muffin', 'chocolate-muffin', 'Rich chocolate chip muffin', 'Flour, cocoa, chocolate chips, eggs', 20000, NULL, 8000, 1, 0, 3, 2),
(5, 'French Fries', 'classic-french-fries', 'Crispy golden french fries', 'Potatoes, salt', 18000, 25000, 7000, 1, 0, 10, 3),
(5, 'Chicken Wings', 'buffalo-chicken-wings', 'Spicy buffalo chicken wings', 'Chicken wings, buffalo sauce, celery', 32000, 45000, 14000, 1, 1, 20, 4),
(5, 'Onion Rings', 'crispy-onion-rings', 'Beer-battered onion rings', 'Onion, beer batter, breadcrumbs', 22000, 30000, 9000, 1, 0, 12, 5),
(5, 'Cheesecake', 'new-york-cheesecake', 'Classic New York cheesecake', 'Cream cheese, graham crackers, sour cream', 28000, NULL, 12000, 1, 1, 3, 6);

-- ============================================
-- PAYMENT METHODS
-- ============================================
INSERT INTO `payment_methods` (`code`, `name`, `description`, `icon`, `config`, `is_active`, `sort_order`) VALUES
('midtrans', 'Midtrans', 'Pay with Midtrans (Credit Card, GoPay, Bank Transfer, QRIS)', 'bx-credit-card', '{"sandbox": true, "client_key": "", "server_key": ""}', 1, 1),
('ipaymu', 'iPaymu', 'Pay with iPaymu (Virtual Account, QRIS, C Store)', 'bx-wallet', '{"sandbox": true, "va": "", "api_key": ""}', 1, 2),
('doku', 'DOKU', 'Pay with DOKU (Virtual Account, Credit Card)', 'bx-money', '{"sandbox": true, "mall_id": "", "shared_key": ""}', 1, 3),
('manual_transfer', 'Bank Transfer', 'Manual verification bank transfer (BCA, Mandiri, BRI)', 'bx-transfer', '{"banks": [{"name": "BCA", "account": "1234567890", "holder": "PT Stocks Coffee"}, {"name": "Mandiri", "account": "0987654321", "holder": "PT Stocks Coffee"}]}', 1, 4);

-- ============================================
-- VOUCHERS
-- ============================================
INSERT INTO `vouchers` (`code`, `type`, `value`, `min_purchase`, `max_discount`, `usage_limit`, `per_user_limit`, `starts_at`, `expires_at`, `is_active`) VALUES
('WELCOME20', 'percentage', 20.00, 50000, 30000, 100, 1, NOW(), DATE_ADD(NOW(), INTERVAL 30 DAY), 1),
('COFFEE10', 'percentage', 10.00, 30000, 15000, 200, 1, NOW(), DATE_ADD(NOW(), INTERVAL 60 DAY), 1),
('FLAT15K', 'fixed', 15000.00, 100000, NULL, 50, 1, NOW(), DATE_ADD(NOW(), INTERVAL 14 DAY), 1),
('WEEKEND25', 'percentage', 25.00, 75000, 50000, NULL, 1, NOW(), DATE_ADD(NOW(), INTERVAL 7 DAY), 1);

-- ============================================
-- SETTINGS
-- ============================================
INSERT INTO `settings` (`key`, `value`, `type`, `group`, `label`, `description`, `is_public`) VALUES
('business_name', 'Stocks Coffee', 'string', 'business', 'Business Name', 'Your coffee shop name', 1),
('business_tagline', 'Premium Coffee Experience', 'string', 'business', 'Business Tagline', 'Short tagline for marketing', 1),
('business_address', 'Jl. Coffee No. 123, Jakarta Selatan, Indonesia', 'string', 'business', 'Business Address', 'Full address', 1),
('business_phone', '021-1234567', 'string', 'business', 'Business Phone', 'Contact phone number', 1),
('business_whatsapp', '6281234567890', 'string', 'business', 'WhatsApp Number', 'WhatsApp number with country code', 1),
('business_email', 'hello@stockscoffee.com', 'string', 'business', 'Business Email', 'Contact email address', 1),
('business_hours_weekday', '07:00 - 22:00', 'string', 'business', 'Weekday Hours', 'Monday-Friday operating hours', 1),
('business_hours_weekend', '08:00 - 23:00', 'string', 'business', 'Weekend Hours', 'Saturday-Sunday operating hours', 1),
('google_maps_embed', '<iframe src="https://www.google.com/maps/embed" width="100%" height="300" style="border:0;" allowfullscreen="" loading="lazy"></iframe>', 'string', 'business', 'Google Maps Embed', 'Google Maps iframe embed code', 1),
('social_instagram', 'stockscoffee', 'string', 'social', 'Instagram', 'Instagram username', 1),
('social_facebook', 'stockscoffee', 'string', 'social', 'Facebook', 'Facebook page name', 1),
('social_tiktok', 'stockscoffee', 'string', 'social', 'TikTok', 'TikTok username', 1),
('tax_rate', '0', 'integer', 'payment', 'Tax Rate (%)', 'Tax percentage applied to orders', 0),
('service_charge', '0', 'integer', 'payment', 'Service Charge (%)', 'Service charge percentage', 0),
('hero_title', 'Experience the Perfect Cup', 'string', 'appearance', 'Hero Title', 'Main landing page title', 1),
('hero_subtitle', 'Artisan coffee crafted with passion and precision. Every sip tells a story of quality and dedication.', 'string', 'appearance', 'Hero Subtitle', 'Landing page subtitle', 1),
('hero_button_primary', 'Order Now', 'string', 'appearance', 'Primary Hero Button', 'Main CTA button text', 1),
('hero_button_secondary', 'View Menu', 'string', 'appearance', 'Secondary Hero Button', 'Secondary button text', 1),
('about_title', 'Our Coffee Story', 'string', 'appearance', 'About Title', 'About section title', 1),
('about_content', 'Founded in 2020, Stocks Coffee began with a simple mission: to serve exceptional coffee in a warm, welcoming environment. We source our beans directly from sustainable farms across Indonesia, Ethiopia, and Colombia, ensuring every cup supports both quality and ethical practices.', 'string', 'appearance', 'About Content', 'About section description', 1),
('facilities_wifi', '1', 'boolean', 'business', 'WiFi Available', 'Facility: Free WiFi', 1),
('facilities_ac', '1', 'boolean', 'business', 'Air Conditioning', 'Facility: Indoor AC', 1),
('facilities_smoking', '1', 'boolean', 'business', 'Smoking Area', 'Facility: Smoking area available', 1),
('facilities_charging', '1', 'boolean', 'business', 'Charging Station', 'Facility: Device charging', 1),
('min_order_amount', '0', 'integer', 'payment', 'Minimum Order Amount', 'Minimum order in IDR', 0),
('currency', 'IDR', 'string', 'payment', 'Currency', 'Currency code', 0);

