<?php

namespace Database\Seeders;

use App\Models\Plan;
use Illuminate\Database\Seeder;

class NewPlansSeeder extends Seeder
{
    public function run(): void
    {
        // Delete existing plans (force delete if needed)
        Plan::query()->forceDelete();

        // Create new plans as per requirements
        $plans = [
            [
                'name' => 'Basic Plan (Monthly)',
                'slug' => 'basic-monthly',
                'duration_days' => 30,
                'product_limit' => 10,
                'product_image_limit' => 4,
                'inquiry_limit' => 10,
                'banner_limit' => 1,
                'has_certificates' => false,
                'has_video' => false,
                'custom_page_limit' => 0,
                'price_inr' => 350,
                'price_usd' => 6,
                'features' => json_encode([
                    '10 Product Listings',
                    '10 Buyer Notifications via Email',
                    'Basic Support',
                    'Contact Details Visible to Buyers',
                    '4 Images per Product',
                    'Send Inquiry Button Active'
                ]),
                'is_active' => true,
                'show_contact_details' => true,
                'view_buyer_contact' => true,
                'is_featured' => false,
                'has_verified_badge' => false,
                'allow_microsite' => false,
                'commission_rate' => 0,
            ],
            [
                'name' => 'Basic Plan (3 Months)',
                'slug' => 'basic-3-months',
                'duration_days' => 90,
                'product_limit' => 10,
                'product_image_limit' => 4,
                'inquiry_limit' => 30,
                'banner_limit' => 1,
                'has_certificates' => false,
                'has_video' => false,
                'custom_page_limit' => 0,
                'price_inr' => 999,
                'price_usd' => 15,
                'features' => json_encode([
                    '10 Product Listings',
                    '30 Buyer Notifications via Email',
                    'Basic Support',
                    'Contact Details Visible to Buyers',
                    '4 Images per Product',
                    'Send Inquiry Button Active'
                ]),
                'is_active' => true,
                'show_contact_details' => true,
                'view_buyer_contact' => true,
                'is_featured' => false,
                'has_verified_badge' => false,
                'allow_microsite' => false,
                'commission_rate' => 0,
            ],
            [
                'name' => 'Silver Plan (Monthly)',
                'slug' => 'silver-monthly',
                'duration_days' => 30,
                'product_limit' => 20,
                'product_image_limit' => 4,
                'inquiry_limit' => 20,
                'banner_limit' => 2,
                'has_certificates' => false,
                'has_video' => false,
                'custom_page_limit' => 1,
                'price_inr' => 600,
                'price_usd' => 12,
                'features' => json_encode([
                    '20 Product Listings',
                    '20 Buyer Notifications via Email',
                    'Basic Support',
                    'Contact Details Visible to Buyers',
                    '4 Images per Product',
                    'Send Inquiry Button Active'
                ]),
                'is_active' => true,
                'show_contact_details' => true,
                'view_buyer_contact' => true,
                'is_featured' => false,
                'has_verified_badge' => false,
                'allow_microsite' => false,
                'commission_rate' => 0,
            ],
            [
                'name' => 'Silver Plan (3 Months)',
                'slug' => 'silver-3-months',
                'duration_days' => 90,
                'product_limit' => 60,
                'product_image_limit' => 4,
                'inquiry_limit' => 60,
                'banner_limit' => 2,
                'has_certificates' => false,
                'has_video' => true,
                'custom_page_limit' => 1,
                'price_inr' => 1699,
                'price_usd' => 32,
                'features' => json_encode([
                    '60 Product Listings',
                    '60 Buyer Notifications via Email',
                    'Basic Support',
                    'Contact Details Visible to Buyers',
                    '4 Images per Product',
                    'Send Inquiry Button Active'
                ]),
                'is_active' => true,
                'show_contact_details' => true,
                'view_buyer_contact' => true,
                'is_featured' => true,
                'has_verified_badge' => false,
                'allow_microsite' => false,
                'commission_rate' => 0,
            ],
        ];

        foreach ($plans as $plan) {
            Plan::create($plan);
        }

        $this->command->info('✅ New subscription plans created successfully!');
    }
}
