<?php


namespace AutoAdmin\Bundle\Content\Entity\Traits;


use AutoAdmin\Bundle\BrickBuilder\Attributes\BrickBuilder;
use AutoAdmin\Bundle\BrickBuilder\Entity\Brick;
use AutoAdmin\Bundle\BrickBuilder\Model\BrickInterface;
use Doctrine\ORM\Mapping as ORM;

trait BrickTrait
{
    #[BrickBuilder]
    #[ORM\OneToOne(targetEntity: Brick::class, cascade: ['persist'])]
    protected ?BrickInterface $brick = null;

    /**
     * @return BrickInterface|null
     */
    public function getBrick(): ?BrickInterface
    {
        return $this->brick;
    }

    /**
     * @param BrickInterface|null $brick
     */
    public function setBrick(?BrickInterface $brick): void
    {
        $this->brick = $brick;
    }
}
