<?php
require_once __DIR__ . '/../config.php';

function seed_platforms() {
    $pdo = db();
    $platforms = [
        ['name' => 'Amazon', 'slug' => 'amazon', 'logo_url' => 'assets/images/logos/amazon.png'],
        ['name' => 'Flipkart', 'slug' => 'flipkart', 'logo_url' => 'assets/images/logos/flipkart.png'],
        ['name' => 'Myntra', 'slug' => 'myntra', 'logo_url' => 'assets/images/logos/myntra.png'],
        ['name' => 'Zomato', 'slug' => 'zomato', 'logo_url' => 'assets/images/logos/zomato.png'],
        ['name' => 'Swiggy', 'slug' => 'swiggy', 'logo_url' => 'assets/images/logos/swiggy.png'],
        ['name' => 'Magicpin', 'slug' => 'magicpin', 'logo_url' => 'assets/images/logos/magicpin.png'],
        ['name' => 'Blinkit', 'slug' => 'blinkit', 'logo_url' => 'assets/images/logos/blinkit.png'],
        ['name' => 'Jiomart', 'slug' => 'jiomart', 'logo_url' => 'assets/images/logos/jiomart.png'],
        ['name' => 'Instamart', 'slug' => 'instamart', 'logo_url' => 'assets/images/logos/instamart.png'],
        ['name' => 'BookMyShow', 'slug' => 'bookmyshow', 'logo_url' => 'assets/images/logos/bookmyshow.png'],
        ['name' => 'PaytmMovies', 'slug' => 'paytmmovies', 'logo_url' => 'assets/images/logos/paytmmovies.png'],
        ['name' => 'PVR', 'slug' => 'pvr', 'logo_url' => 'assets/images/logos/pvr.png'],
    ];

    $stmt = $pdo->prepare("INSERT INTO platforms (name, slug, logo_url) VALUES (:name, :slug, :logo_url) ON DUPLICATE KEY UPDATE name=VALUES(name), slug=VALUES(slug), logo_url=VALUES(logo_url)");

    foreach ($platforms as $platform) {
        $stmt->execute($platform);
    }

    echo "Platforms seeded successfully.\n";
}

seed_platforms();
