<?php

namespace BYDAuto;

use BYDAuto\Commands\AliPromotepageCommand;
use BYDAuto\Commands\BYDAutoCommand;
use BYDAuto\Commands\BYDAutoNoticeCommand;
use BYDAuto\Commands\GeocodingCommand;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Support\ServiceProvider;

class BYDAutoServiceProvider extends ServiceProvider
{
    public function register()
    {
        $root = dirname(__DIR__);

        // migrate
        $this->loadMigrationsFrom($root . '/migrations');

        $this->commands([
            AliPromotepageCommand::class,
            BYDAutoCommand::class,
            GeocodingCommand::class,
            BYDAutoNoticeCommand::class,
        ]);

        $this->mergeConfigFrom($root . '/config/bydauto.php', 'bydauto');
        $this->loadRoutesFrom($root . '/routes/api.php');
        $this->loadViewsFrom($root . '/views', 'bydauto');
    }

    public function boot()
    {
        // $this->app->booted(function () {
        //     $schedule = $this->app->make(Schedule::class);
        //     $schedule->command('bydauto:notice')->dailyAt('09:00');
        // });
    }
}
