-- =============================================
-- MIGRATION: Home Page CMS Settings
-- Singleton settings table for the public landing / home page
-- Pattern: singleton row (id='home_cms_default')
-- =============================================

CREATE TABLE IF NOT EXISTS home_page_settings (
    id VARCHAR(100) PRIMARY KEY DEFAULT 'home_cms_default',
    
    -- 1. Hero Section
    hero_title VARCHAR(500) NOT NULL DEFAULT 'Discover the Ultimate Luxury Living',
    hero_subtitle TEXT NOT NULL,
    hero_video_url VARCHAR(500) NOT NULL DEFAULT '/videos/hero-bg.mp4',
    
    -- 2. Trust / Stats Bar (4 columns)
    stat1_number VARCHAR(100) NOT NULL DEFAULT '12+',
    stat1_label VARCHAR(200) NOT NULL DEFAULT 'Years Experience',
    stat2_number VARCHAR(100) NOT NULL DEFAULT '200+',
    stat2_label VARCHAR(200) NOT NULL DEFAULT 'Successful Projects',
    stat3_number VARCHAR(100) NOT NULL DEFAULT 'AED 5B+',
    stat3_label VARCHAR(200) NOT NULL DEFAULT 'Properties Sold',
    stat4_number VARCHAR(100) NOT NULL DEFAULT '99%',
    stat4_label VARCHAR(200) NOT NULL DEFAULT 'Client Satisfaction',
    
    -- 3. Trusted Partners
    partners_list TEXT NOT NULL,

    -- 4. Our Premium Services Section
    service1_title VARCHAR(200) NOT NULL DEFAULT 'Property Sales',
    service1_desc TEXT NOT NULL,
    service2_title VARCHAR(200) NOT NULL DEFAULT 'Property Search',
    service2_desc TEXT NOT NULL,
    service3_title VARCHAR(200) NOT NULL DEFAULT 'Property Management',
    service3_desc TEXT NOT NULL,
    service4_title VARCHAR(200) NOT NULL DEFAULT 'Real Estate Advisory',
    service4_desc TEXT NOT NULL,
    services_image_url VARCHAR(1000) NOT NULL DEFAULT '/images/premium-services.jpg',

    -- 5. Testimonial Section
    testimonial_quote TEXT NOT NULL,
    testimonial_author VARCHAR(200) NOT NULL DEFAULT 'Sarah Jenkins',
    testimonial_role VARCHAR(200) NOT NULL DEFAULT 'Property Investor',
    
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

-- Seed with the exact defaults
INSERT IGNORE INTO home_page_settings (
    id,
    hero_title, hero_subtitle, hero_video_url,
    stat1_number, stat1_label, stat2_number, stat2_label,
    stat3_number, stat3_label, stat4_number, stat4_label,
    partners_list,
    service1_title, service1_desc,
    service2_title, service2_desc,
    service3_title, service3_desc,
    service4_title, service4_desc,
    services_image_url,
    testimonial_quote, testimonial_author, testimonial_role
) VALUES (
    'home_cms_default',
    'Discover the Ultimate Luxury Living',
    'Exclusive properties, unparalleled service, and expert advisory in the heart of Dubai.',
    '/videos/hero-bg.mp4',
    '12+', 'Years Experience',
    '200+', 'Successful Projects',
    'AED 5B+', 'Properties Sold',
    '99%', 'Client Satisfaction',
    'Khalid Al-Emaar, Omar Al-Rashid, Fatima Al-Nakheel, Vanguard Group, Emaar Developer, BR AR',
    'Property Sales', 'Our expert team ensures a seamless sales process, leveraging deep market knowledge and an extensive network.',
    'Property Search', 'Tailored property finding services matching your premium requirements.',
    'Property Management', 'Stress-free luxury asset and tenant coordination management.',
    'Real Estate Advisory', 'High-end market analysis, valuation, and wealth-building strategies.',
    '/images/premium-services.jpg',
    '"The level of professionalism and market insight provided was unparalleled. They found the perfect off-plan investment that exceeded all expectations."',
    'Sarah Jenkins',
    'Property Investor'
);

-- Verification
SELECT 'home_page_settings' AS tbl, COUNT(*) AS row_count FROM home_page_settings;
