<?php

namespace CouponsPlus\App\Coupon\Tree\Abilities;

use CouponsPlus\App\Conditions\ItemsSet;
use CouponsPlus\App\Coupon\Tree\TestableGroup;
use CouponsPlus\Original\Characters\StringManager;
use CouponsPlus\Original\Collections\Collection;

interface Branch extends WithNodeData
{
    /**
     * Computes the best type of the branch based on its properties.
     */
    public function getType() : StringManager; 
    public function getChildren() : Collection; //Node[]|Leaf[]

    /**
     * PLEASE NOTE: This is different from getType()!
     * gettype() might be dynamic whereas this is designed to be static. for example:
     *
     * is('tiered') = true
     * getType()->is('tiered') = false
     */
    public function is($type) : bool;
    public function getExtraData() : ?object;

    /**
     * @return Collection of ItemsSet's to exclude
     */
    public function getItemsToExclude(ItemsSet $itemsSet) : Collection;

    /**
     * This is for calculation on the previous node on the subset layer.
     *
     * These are items that will be passed to the current branch's node and that have already been filtered except for subset sum calculations (aka NumberOfItems/Quantity)
     *
     * This is mainly for BOGO offers that require a fixed qty to be passed to them.
     */
    public function filterItemsSetContextQuantityBeforePassingToBranch(ItemsSet $filteredItemsSet, TestableGroup $testableGroup) : ItemsSet;

    /**
     * This is for picking the best items in a composition group (AND, OR, etc.)
     *
     * Again, this is mainly for BOGOs, because bogos need an exact quantity to pass to the offer.
    public function filterItemsSetGroupQuantityBeforePassingToBranch(ItemsSet $filteredItemsSet, TestableGroup $testableGroup) : ItemsSet;
     */

}