USE gp_crackers;

CREATE TABLE IF NOT EXISTS products (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(100) NOT NULL,
    category VARCHAR(50) NOT NULL,
    price DECIMAL(10, 2) NOT NULL,
    image_url VARCHAR(255) NOT NULL,
    description TEXT,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Seed initial products from products.html
INSERT INTO products (name, category, price, image_url) VALUES
('Color Koti', 'flowerpots', 150.00, './assets/images/products/product_1.jpg'),
('7cm Color Sparklers', 'sparklers', 80.00, './assets/images/products/7-cm-color-sparklers.png'),
('Lunik Express', 'rockets', 250.00, './assets/images/products/lunik-rocket-express.jpg'),
('Big Chakkar', 'ground', 100.00, './assets/images/products/Ground-Chakara-Big-1-scaled.jpg'),
('Chit Put', 'bombs', 50.00, './assets/images/products/Chit-Put-min-scaled.jpg'),
('Atom Bomb', 'bombs', 120.00, './assets/images/products/crackers1.jpg'),
('Iron Man', 'fancy', 300.00, './assets/images/products/Iron-Man-scaled.jpg'),
('Super Man', 'fancy', 300.00, './assets/images/products/Super-Man-scaled.jpg')
ON DUPLICATE KEY UPDATE price = VALUES(price), image_url = VALUES(image_url);
