<?php

namespace CouponsPlus\App\Coupon\Tree\Finders;

use CouponsPlus\App\Coupon\Tree\Abilities\Branch;
use CouponsPlus\App\Coupon\Tree\Abilities\NodeData;
use CouponsPlus\App\Coupon\Tree\Abilities\NodeDatas;
use CouponsPlus\Original\Collections\Collection;

class NodeDatasWithBranch implements NodeDatas
{
    private $branch;
    protected $nodeDatasFromCollection;

    public function __construct(Branch $branch)
    {
        $this->branch = $branch;
        $this->nodeDatasFromCollection = new NodeDatasCollection($branch->getChildren());
    }

    public function getBranch() : Branch
    {
        return $this->branch;
    }

    public function get(): Collection
    {
        return $this->nodeDatasFromCollection->get();        
    } 

    public function addToIgnoreList(NodeData $nodeData)
    {
        return $this->nodeDatasFromCollection->addToIgnoreList($nodeData);       
    } 
}