<?php

namespace PixelioCartAbandonRecoveryMore\Admin\Services\Tracking;

use PixelioCartAbandonRecoveryMore\Frontend\Repositories\Pixelio_Cart_Abandon_Recovery_More_Session_Repository;

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

class Pixelio_Cart_Abandon_Recovery_More_Consent_Tracking_Strategy implements Pixelio_Cart_Abandon_Recovery_More_Tracking_Strategy_Interface
{
    private Pixelio_Cart_Abandon_Recovery_More_Session_Repository $session_model;

    public function __construct($session_model)
    {
        $this->session_model = $session_model;
    }

    public function track(Pixelio_Cart_Abandon_Recovery_More_Event_Dto $event): void
    {
        if (empty($event->uuid)) {
            return;
        }

        $this->session_model->pixelio_cart_abandon_recovery_more_add_session_data(
            $event->uuid,
            $event->page_url,
            $event->product_id ?? 0,
            $event->parent_product_id ?? 0,
            $event->event_type,
            $event->visit_duration,
            $event->scroll_percent,
			$event->tracking_mode,
        );
    }
}
