<?php

namespace Magetop\Agency\Plugin\Checkout\Block\Cart\Item\Renderer\Actions;

class Generic
{
    /**
     * @var \Magetop\Agency\Helper\Data
     */
    private $_helper;

    /**
     * Initialize dependencies.
     *
     * @param \Magetop\Agency\Helper\Data $helper
     */
    public function __construct(
        \Magetop\Agency\Helper\Data $helper
    ) {
        $this->_helper = $helper;
    }

    public function afterIsProductVisibleInSiteVisibility(
        \Magento\Checkout\Block\Cart\Item\Renderer\Actions\Generic $subject,
        $result
    ) {
        $assignData = $this->_helper->getAssignDataByItemId($subject->getItem()->getId());
        if ($assignData['assign_id'] > 0) {
            return false;
        }
        return $result;
    }
}
