<?php

namespace Kylin\Adminlte\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;

/**
 * AdminLTE 安装命令
 *
 * Artisan 命令：php artisan kylin:adminlte:install
 * 发布 AdminLTE 的配置、视图、静态资源到项目中。
 */
class InstallCommand extends Command
{
    protected $signature = 'kylin:adminlte:install';
    protected $description = 'Install Kylin AdminLTE assets and views';

    public function handle(): int
    {
        $this->info('Installing Kylin AdminLTE...');

        // 发布配置
        $this->call('vendor:publish', ['--tag' => 'kylin-adminlte-config', '--force' => true]);

        // 发布视图
        $this->call('vendor:publish', ['--tag' => 'kylin-adminlte-views', '--force' => true]);

        // 发布前端资源
        $this->call('vendor:publish', ['--tag' => 'kylin-adminlte-assets', '--force' => true]);

        $this->info('Kylin AdminLTE installed successfully.');
        return self::SUCCESS;
    }
}
