<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class PhaseTwoPlanSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $plans = [
            [
                'slug' => 'basic-monthly',
                'name' => 'Basic Plan (Monthly)',
                'type' => 'basic',
                'description' => 'Great for starters. 10 Product Listings.',
                'price' => 350,
                'price_inr' => 350,
                'price_usd' => 6,
                'duration' => 30,
                'duration_months' => 1,
                'product_limit' => 10,
                'features' => json_encode(['10 Buyer Notifications', 'Basic Support', 'Visible Contact Details']),
                'limits' => json_encode(['inquiry' => true, 'contact_view' => true]),
                'is_active' => true,
                'created_at' => now(),
                'updated_at' => now(),
            ],
            [
                'slug' => 'basic-quarterly',
                'name' => 'Basic Plan (3 Months)',
                'type' => 'basic',
                'description' => 'Save more. 30 Product Listings.',
                'price' => 999,
                'price_inr' => 999,
                'price_usd' => 15,
                'duration' => 90,
                'duration_months' => 3,
                'product_limit' => 30,
                'features' => json_encode(['30 Buyer Notifications', 'Basic Support', 'Visible Contact Details']),
                'limits' => json_encode(['inquiry' => true, 'contact_view' => true]),
                'is_active' => true,
                 'created_at' => now(),
                'updated_at' => now(),
            ],
            [
                'slug' => 'silver-monthly',
                'name' => 'Silver Plan (Monthly)',
                'type' => 'silver',
                'description' => 'For growing businesses. 20 Product Listings.',
                'price' => 600,
                'price_inr' => 600,
                'price_usd' => 12,
                'duration' => 30,
                'duration_months' => 1,
                'product_limit' => 20,
                'features' => json_encode(['20 Buyer Notifications', 'Basic Support', 'Visible Contact Details']),
                'limits' => json_encode(['inquiry' => true, 'contact_view' => true]),
                'is_active' => true,
                 'created_at' => now(),
                'updated_at' => now(),
            ],
            [
                'slug' => 'silver-quarterly',
                'name' => 'Silver Plan (3 Months)',
                'type' => 'silver',
                'description' => 'Aggressive growth. 60 Product Listings.',
                'price' => 1699,
                'price_inr' => 1699,
                'price_usd' => 32,
                'duration' => 90,
                'duration_months' => 3,
                'product_limit' => 60,
                'features' => json_encode(['60 Buyer Notifications', 'Basic Support', 'Visible Contact Details']),
                'limits' => json_encode(['inquiry' => true, 'contact_view' => true]),
                'is_active' => true,
                 'created_at' => now(),
                'updated_at' => now(),
            ],
        ];

        foreach ($plans as $plan) {
            DB::table('plans')->updateOrInsert(
                ['slug' => $plan['slug']],
                $plan
            );
        }
    }
}
