-- =============================================
-- Ghalla Mandi ERP: Seed Data
-- Database: naveed_trader_db
-- =============================================

-- ===== 1. Admin User =====
-- Password: admin123 (bcrypt hash)
INSERT INTO `users` (`username`, `full_name`, `password_hash`, `department`, `role`, `status`) VALUES
('admin', 'بابا نوید', '$2y$10$YsvtMBwUYmD1K3swx2nybOcpKxXJMUnKMJ0k9uhObiVIBD72EB/ju', 'انتظامیہ', 'admin', 'active');

-- Admin Permissions (full access to everything)
INSERT INTO `permissions` (`user_id`, `module`, `can_view`, `can_create`, `can_edit`, `can_delete`, `can_print`) VALUES
(1, 'dashboard', 1, 1, 1, 1, 1),
(1, 'purchase', 1, 1, 1, 1, 1),
(1, 'sale', 1, 1, 1, 1, 1),
(1, 'ledger', 1, 1, 1, 1, 1),
(1, 'cashBank', 1, 1, 1, 1, 1),
(1, 'expense', 1, 1, 1, 1, 1),
(1, 'setup', 1, 1, 1, 1, 1),
(1, 'users', 1, 1, 1, 1, 1);

-- ===== 2. Munshi User =====
INSERT INTO `users` (`username`, `full_name`, `password_hash`, `department`, `role`, `status`) VALUES
('mns101', 'محمد اسلم منشی', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'اکاؤنٹس', 'operator', 'active');

INSERT INTO `permissions` (`user_id`, `module`, `can_view`, `can_create`, `can_edit`, `can_delete`, `can_print`) VALUES
(2, 'dashboard', 1, 0, 0, 0, 0),
(2, 'purchase', 1, 1, 0, 0, 1),
(2, 'sale', 1, 1, 0, 0, 1),
(2, 'ledger', 1, 0, 0, 0, 1),
(2, 'cashBank', 1, 1, 0, 0, 1),
(2, 'expense', 1, 1, 0, 0, 1),
(2, 'setup', 0, 0, 0, 0, 0),
(2, 'users', 0, 0, 0, 0, 0);

-- ===== 3. System Accounts (Cannot be deleted) =====
INSERT INTO `accounts` (`name`, `type`, `sub_type`, `opening_balance`, `balance_type`, `is_system`) VALUES
-- Bank & Cash
('Cash in Hand', 'bank_cash', 'cash', 0.00, 'Dr', 1),
-- System Income Accounts
('Commission Account', 'system_income', 'commission', 0.00, 'Cr', 1),
('Market Fee Account', 'system_income', 'market_fee', 0.00, 'Cr', 1),
('Sale Account', 'system_income', 'sale', 0.00, 'Cr', 1),
-- System Expense Accounts
('Mazdoori Account', 'system_expense', 'mazdoori', 0.00, 'Dr', 1),
('Tora Account', 'system_expense', 'tora', 0.00, 'Dr', 1),
('Kiraya Account', 'system_expense', 'kiraya', 0.00, 'Dr', 1),
('Purchase Account', 'system_expense', 'purchase', 0.00, 'Dr', 1),
('General Expense Account', 'system_expense', 'expense', 0.00, 'Dr', 1),
-- Capital Accounts
('Original Capital (اصل سرمایہ)', 'capital', 'equity', 0.00, 'Cr', 1),
('capital (سرمایہ)', 'bank_cash', 'cash', 0.00, 'Dr', 0);

-- ===== 4. Default Items (Jins) =====
INSERT INTO `items` (`name`, `unit`) VALUES
('گندم (Kanak)', 'KG'),
('مکئی (Makai)', 'KG'),
('سرسوں (Sarson)', 'KG'),
('چنا (Chana)', 'KG'),
('باجرہ (Bajra)', 'KG');
