<?php

namespace AutoAdmin\Bundle\Content\Entity\Traits;

use AutoAdmin\Bundle\Content\Entity\Locale;
use AutoAdmin\Bundle\Content\Model\LocaleInterface;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;

trait LocalizedTrait
{
    #[ORM\ManyToOne(targetEntity: Locale::class)]
    #[Groups(['locale'])]
    protected ?LocaleInterface $locale = null;

    public function getLocale(): ?LocaleInterface
    {
        return $this->locale;
    }

    public function setLocale(?LocaleInterface $locale): void
    {
        $this->locale = $locale;
    }
}