<?php

namespace App\Console;

use App\Console\Commands\ApplicationLanguageFiles\ApplicationLanguageFiles;
use App\Console\Commands\ApplicationLanguageFiles\ApplicationLanguageBaseData;
use App\Console\Commands\ApplicationLanguageFiles\ApplicationFillTableLanguageKey;
use App\Console\Commands\ChannelManager\BestAvailableRateSyncService;
use App\Console\Commands\ChannelManager\MetaCancellationService;
use App\Console\Commands\ChannelManager\PropertyBookingSyncService;
use App\Console\Commands\ChannelManager\PropertyChannelSyncService;
use App\Console\Commands\ChannelManager\PropertyMetaRoomRatePriceService;
use App\Console\Commands\ChannelManager\PropertyMetaRoomRatePushService;
use App\Console\Commands\ChannelManager\PropertyMetaRoomRateService;
use App\Console\Commands\ChannelManager\RemovePaymentTokenService;
use App\Console\Commands\ChannelManager\ReselivaAvailRateUpdateService;
use App\Console\Commands\ChannelManager\ReservationPushService;
use App\Console\Commands\ChannelManager\ReservationPullService;
use App\Console\Commands\ChannelManager\RoomAvailabilityPushService;
use App\Console\Commands\CurrencyRates\CurrencyRatesService;
use App\Console\Commands\ChannelManager\RoomRatePushService;
use App\Console\Commands\Data\DashboardCacheService;
use App\Console\Commands\Data\HotelBedsList;
use App\Console\Commands\Data\WeatherService;
use App\Console\Commands\Google\GoogleReview;
use App\Console\Commands\Google\GoogleStaticMap;
use App\Console\Commands\Jobs\BookingCommissionService;
use App\Console\Commands\Jobs\BookingEngineSearchReportService;
use App\Console\Commands\Jobs\DataFetch;
use App\Console\Commands\Jobs\PriceComparisonService;
use App\Console\Commands\Jobs\PropertyCatalogService;
use App\Console\Commands\Jobs\PropertyInvoiceService;
use App\Console\Commands\Jobs\PropertySummaryService;
use App\Console\Commands\PropertyReviewService\PropertyReviewAnalyzeService;
use App\Console\Commands\PropertyReviewService\PropertyReviewScheduleService;
use App\Console\Commands\PropertyReviewService\PropertyReviewService;
use App\Console\Commands\Jobs\SummaryReportMail;
use App\Console\Commands\Jobs\SummaryReportMailSales;
use App\Console\Commands\PropertyTrialCheck\PropertyTrialCheck;
use App\Console\Commands\PropertyTrialCheck\PropertyTrialMail;
use App\Console\Commands\PropertyWebCheckDns\PropertyWebCheckDns;
use App\Console\Commands\Google\GoogleVisioLabel;
use App\Console\Commands\Jobs\MailJobs;
use App\Console\Commands\PropertyWebMenuMapping\PropertyWebMenuMappingConsole;
use Illuminate\Console\Scheduling\Schedule;

use Laravel\Lumen\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        GoogleVisioLabel::class,
        MailJobs::class,
        ApplicationLanguageFiles::class,
        ApplicationLanguageBaseData::class,
        ApplicationFillTableLanguageKey::class,
        PropertyWebCheckDns::class,
        CurrencyRatesService::class,
        PropertyWebMenuMappingConsole::class,
        RoomRatePushService::class,
        RoomAvailabilityPushService::class,
        ReservationPullService::class,
        PropertyTrialCheck::class,
        PropertyTrialMail::class,
        HotelBedsList::class,
        ReservationPushService::class,
        SummaryReportMail::class,
        PropertyChannelSyncService::class,
        PropertyBookingSyncService::class,
        BestAvailableRateSyncService::class,
        RemovePaymentTokenService::class,
        BookingEngineSearchReportService::class,
        PropertyMetaRoomRateService::class,
        PropertyMetaRoomRatePriceService::class,
        PropertyMetaRoomRatePushService::class,
        WeatherService::class,
        BookingCommissionService::class,
        DashboardCacheService::class,
        GoogleReview::class,
        SummaryReportMailSales::class,
        GoogleStaticMap::class,
        PriceComparisonService::class,
        PropertyCatalogService::class,
        PropertyInvoiceService::class,
        PropertyReviewService::class,
        PropertyReviewScheduleService::class,
        PropertyReviewAnalyzeService::class,
        DataFetch::class,
        MetaCancellationService::class,
        PropertySummaryService::class
        //ReselivaAvailRateUpdateService::class
    ];

    /**
     * Define the application's command schedule.
     *
     * @param \Illuminate\Console\Scheduling\Schedule $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        /*$schedule->command('cron:mail-jobs')
            ->withoutOverlapping()
            ->everyMinute()
            ->sendOutputTo(storage_path() . '/logs/cron-mail-jobs.log');*/

        $schedule->command('cron:mail-jobs')->everyMinute();

        $schedule->command('cron:currency-rates')
            ->withoutOverlapping()
            ->twiceDaily(2, 14)
            //->everyMinute()
            //->emailOutputTo('byumak@rezervasyon.com')
            ->sendOutputTo(storage_path() . '/logs/cron-currency-rates.log');

        $schedule->command('cron:roomrate-push-service')->everyMinute();
        $schedule->command('cron:roomavailability-push-service')->everyMinute();
        $schedule->command('cron:reservation-pull-service')->everyMinute();
        $schedule->command('cron:reservation-push-service')->everyMinute();

        $schedule->command('cron:property-trial-check')->withoutOverlapping()->twiceDaily(9, 15);
        $schedule->command('cron:property-trial-mail')->withoutOverlapping()->dailyAt('10:00');

        //$schedule->command('queue:work')->everyMinute()->withoutOverlapping();
        $schedule->command('queue:restart')->hourly()->withoutOverlapping();

        $schedule->command('cron:summary-report-mail')->dailyAt('00:05');
        $schedule->command('cron:summary-report-mail-sales')->dailyAt('09:00');
        $schedule->command('cron:remove-payment-token-service')->withoutOverlapping()->dailyAt('02:00');
        $schedule->command('cron:bookingengine-search-report-mail')->withoutOverlapping()->dailyAt('09:00');

        $schedule->command('cron:propertymeta-roomrate-service')->withoutOverlapping()->dailyAt('03:00');
        $schedule->command('cron:propertymeta-roomrateprice-service')->withoutOverlapping()->dailyAt('05:00');
        $schedule->command('cron:propertymeta-roomratepush-service')->withoutOverlapping()->dailyAt('07:00');

        //$schedule->command('cron:bar-sync-service')->withoutOverlapping()->cron('0 */2 * * *');
        $schedule->command('cron:bar-sync-service')->cron('0 */2 * * *');

        $schedule->command('cron:price-comparison-service')->withoutOverlapping()->weekly()->mondays()->at('02:00');

        $schedule->command('cron:commission-service')->everyTenMinutes();

        $schedule->command('cron:weather')->withoutOverlapping()->twiceDaily(2, 14);
        $schedule->command('cron:dashboard-cache')->withoutOverlapping()->dailyAt('03:00');
        $schedule->command('cron:google-static-map')->withoutOverlapping()->dailyAt('04:00');

        $schedule->command('cron:google-review')->withoutOverlapping()->weekly()->mondays()->at('14:00');

        $schedule->command('cron:property-invoice-service')->withoutOverlapping()->dailyAt('04:00');
        $schedule->command('cron:property-summary-service')->withoutOverlapping()->dailyAt('04:30');

        $schedule->command('cron:property-review-schedule-service')->withoutOverlapping()->dailyAt('05:00');

        $schedule->command('cron:meta-cancellation-service')->withoutOverlapping()->dailyAt('05:30');
    }
}
