<?php

namespace Maestro\Core\Console\Commands;

use Illuminate\Console\Command;

class UpdateCommand extends Command
{
    protected $signature   = 'maestro:update';
    protected $description = 'Update Maestro in this project';

    public function handle(): void
    {
        $this->newLine();
        $this->line('  <fg=cyan;options=bold>Maestro Updater</>');
        $this->line('  ' . str_repeat('─', 40));
        $this->newLine();

        $this->line('  <fg=yellow>→</> Running migrations');
        $this->call('migrate', ['--quiet' => true]);

        $this->newLine();
        $this->line('  <fg=green;options=bold>✓ Maestro updated successfully.</>');
        $this->newLine();
        $this->line('  <options=bold>Also run on frontend:</>');
        $this->line('  <fg=yellow>npm update @maestro/core</>');
        $this->newLine();
    }
}
