<?php

namespace CouponsPlus\App\Coupon\Tree;

use CouponsPlus\Original\Characters\StringManager;

class RawTestableDataInspector
{
    protected object $testableData;

    public function __construct(object $testableData)
    {
        $this->testableData = $testableData;
    }

    public function isGroup() : bool
    {
        return property_exists($this->testableData, 'mode');
    }

    public function isPartial() : bool
    {
        return StringManager::create($this->testableData->id ?? '')->contains('testable-partial');
    }

    public function hasChildren() : bool
    {
        return property_exists($this->testableData, 'children') && is_array($this->testableData->children) && count($this->testableData->children) > 0;
    }
}