<?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_Anonymous_Aggregate_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
    {
        $this->session_model->pixelio_increment_anonymous_event(
            $event->event_type,
            $event->product_id ?? 0,
            $event->page_type ?? 'unknown'
        );
    }
}
