<?php

namespace Aura\Flows;

use Aura\Base\Facades\Aura;
use Aura\Flows\Commands\FlowsCommand;
use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;

class FlowsServiceProvider extends PackageServiceProvider
{
    public function configurePackage(Package $package): void
    {
        if (config('aura.features.flows') == false) {
            $package->name('flows');

            return;
        }

        /*
        * This class is a Package Service Provider
        *
        * More info: https://github.com/spatie/laravel-package-tools
        */
        $package
            ->name('flows')
            ->hasConfigFile()
            ->hasViews()
            ->hasMigration('create_flows_table')
            ->hasCommand(FlowsCommand::class);

        Aura::registerResources([
            \Aura\Flows\Resources\Flow::class,
            \Aura\Flows\Resources\FlowLog::class,
            \Aura\Flows\Resources\Operation::class,
            \Aura\Flows\Resources\OperationLog::class,
        ]);
    }
}
