<?php

namespace AutoAdmin\Bundle\Content\Hierarchy\Model\Traits;

use AutoAdmin\Bundle\Content\Entity\ContentReference;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

// todo: not implemented, feature draft
trait ExternalHierarchyTrait
{
    #[ORM\OneToOne(targetEntity: ContentReference::class)]
    private ?ContentReference $parent = null;

//    #[ORM\OneToMany(mappedBy: 'parent', targetEntity: self::class)]

    private ArrayCollection $children;

    public function __construct()
    {
        $this->children = new ArrayCollection();
    }

    public function getParent(): ?ContentReference
    {
        return $this->parent;
    }

    public function setParent(?ContentReference $parent): self
    {
        $this->parent = $parent;

        return $this;
    }

    public function getChildren(): Collection
    {
        return $this->children;
    }

    public function setChildren(ArrayCollection $children): self
    {
        $this->children = $children;

        return $this;
    }
}
