<?php

namespace Console\Commands;

use Bastion\ScheduledTasks\TeleCartPulseSendEventsTask;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class PulseSendEventsCommand extends TeleCartCommand
{
    protected static $defaultName = 'pulse:send';
    protected static $defaultDescription = 'Manually send pulse events ignoring schedule.';
    private TeleCartPulseSendEventsTask $teleCartPulseSendEventsTask;

    public function __construct(TeleCartPulseSendEventsTask $teleCartPulseSendEventsTask)
    {
        parent::__construct();

        $this->teleCartPulseSendEventsTask = $teleCartPulseSendEventsTask;
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $output->writeln('<info>Sending Pulse events.</info>');
        $this->teleCartPulseSendEventsTask->execute();

        return self::SUCCESS;
    }
}
