CREATE TABLE IF NOT EXISTS app_messages (
    id INT AUTO_INCREMENT PRIMARY KEY,
    message_key VARCHAR(100) UNIQUE NOT NULL,
    message_value TEXT NOT NULL,
    category VARCHAR(50) DEFAULT 'general',
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

-- Seed basic messages
INSERT IGNORE INTO app_messages (message_key, message_value, category) VALUES 
('auth_login_required', 'Please login first', 'error'),
('product_not_found', 'Product not found', 'error'),
('offer_sent_success', 'Offer sent successfully!', 'success'),
('min_rental_duration', 'Minimum rental duration is {min} days', 'error'),
('booking_conflict', 'Product already booked for selected dates', 'error'),
('offer_not_found', 'Invalid offer', 'error'),
('offer_cancelled_success', 'Offer cancelled successfully', 'success'),
('review_submit_success', 'Review submitted successfully!', 'success'),
('already_rated_seller', 'You have already rated this seller', 'error'),
('rating_window_expired', 'Rating window has expired', 'error'),
('order_not_found', 'Order not found', 'error'),
('order_cancel_success', 'Order cancelled successfully', 'success'),
('payment_success', 'Payment successful! Order confirmed.', 'success'),
('dates_update_success', 'Rental dates updated successfully!', 'success');
