<?php

namespace Database\Seeders;

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

class NewSubscriptionPlansSeeder extends Seeder
{
    public function run(): void
    {
        // Update or Create plans using Eloquent (handles FK properly)
        
        // Basic Monthly
        Plan::updateOrCreate(
            ['slug' => 'basic-monthly'],
            [
                'name' => 'Basic Plan (Monthly)',
                'duration_days' => 30,
                'product_limit' => 10,
                'inquiry_limit' => 10,
                'price_inr' => 350,
                'price_usd' => 6,
                'features' => [
                    '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,
            ]
        );

        // Basic 3-Monthly
        Plan::updateOrCreate(
            ['slug' => 'basic-quarterly'],
            [
                'name' => 'Basic Plan (3 Months)',
                'duration_days' => 90,
                'product_limit' => 30,
                'inquiry_limit' => 30,
                'price_inr' => 999,
                'price_usd' => 15,
                'features' => [
                    '30 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,
            ]
        );

        // Silver Monthly
        Plan::updateOrCreate(
            ['slug' => 'silver-monthly'],
            [
                'name' => 'Silver Plan (Monthly)',
                'duration_days' => 30,
                'product_limit' => 20,
                'inquiry_limit' => 20,
                'price_inr' => 600,
                'price_usd' => 12,
                'features' => [
                    '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,
            ]
        );

        // Silver 3-Monthly
        Plan::updateOrCreate(
            ['slug' => 'silver-quarterly'],
            [
                'name' => 'Silver Plan (3 Months)',
                'duration_days' => 90,
                'product_limit' => 60,
                'inquiry_limit' => 60,
                'price_inr' => 1699,
                'price_usd' => 32,
                'features' => [
                    '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,
            ]
        );
    }
}
