<?php
/**
 * Scheduled task: sync notifications from remote feed.
 *
 * @package Awesomemotive\Rewardswp\Tasks
 * @since 1.4.0
 */

namespace Awesomemotive\Rewardswp\Tasks;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

use Awesomemotive\Rewardswp\Interfaces\ScheduledTaskInterface;
use Awesomemotive\Rewardswp\Services\TaskSchedulerService;

/**
 * Class SyncNotificationsTask
 *
 * Syncs plugin notifications from the remote feed.
 *
 * @since 1.4.0
 */
class SyncNotificationsTask implements ScheduledTaskInterface {
	/**
	 * Task scheduler service instance.
	 *
	 * @since 1.4.0
	 *
	 * @var TaskSchedulerService
	 */
	private TaskSchedulerService $service;

	/**
	 * Constructor.
	 *
	 * @since 1.4.0
	 *
	 * @param TaskSchedulerService $service Task scheduler service instance.
	 */
	public function __construct( TaskSchedulerService $service ) {
		$this->service = $service;
	}

	/**
	 * {@inheritDoc}
	 */
	public function get_recurrence(): string {
		return 'daily';
	}

	/**
	 * {@inheritDoc}
	 */
	public function register_hooks(): void {
		// No follow-up hooks needed — single-batch task.
	}

	/**
	 * {@inheritDoc}
	 */
	public function run(): void {
		$this->service->task_sync_notifications();
	}
}
