<?php

declare(strict_types=1);

namespace Autogedal\Reduceri\Model;

use Magento\Catalog\Model\Category;

/**
 * Shared singleton that carries reduceri page state across the request.
 * Replaces Magento\Framework\Registry usage for module-owned flags.
 * Note: current_category must still be registered in Registry for native catalog
 * blocks (Catalog\Block\Category\View, Catalog\Helper\Data) to function correctly.
 */
class ReduceriState
{
    private bool $isCategoryView = false;
    private ?Category $category = null;

    public function setIsCategoryView(bool $value): void
    {
        $this->isCategoryView = $value;
    }

    public function isCategoryView(): bool
    {
        return $this->isCategoryView;
    }

    public function setCategory(Category $category): void
    {
        $this->category = $category;
    }

    public function getCategory(): ?Category
    {
        return $this->category;
    }
}
