<?php

namespace ViartasThemes\Florial\Commands;

use Illuminate\Console\Command;
use ViartasThemes\Florial\Seeders\FlorialThemeSeeder;

class SeedFlorialCommand extends Command
{
    protected $signature = 'florial:seed {--fresh : Delete existing sections and configs before seeding}';

    protected $description = 'Seed Florial theme sections and config values';

    public function handle(): int
    {
        if ($this->option('fresh')) {
            $this->warn('Deleting existing sections and configs...');
            $result = FlorialThemeSeeder::reseed();
            $this->info("Deleted {$result['deleted_sections']} sections, {$result['deleted_configs']} configs");
            $this->info("Created {$result['new_sections']} sections, {$result['new_configs']} configs");
        } else {
            FlorialThemeSeeder::seed();
            $this->info('Florial theme sections seeded (existing skipped).');
        }

        return 0;
    }
}
