<?php

namespace AutoAdmin\Bundle\Content\Entity\Traits;

use AutoAdmin\Bundle\Content\Validator as AutoAdminAssert;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;

/**
 * Beware: indexed-column max varchar length in utf8_general_ci is 255, or 191 in utf8mb4_general_ci (MySQL limitation)
 */
trait SlugAdminTrait
{
    #[ORM\Column(name: 'slug_admin', type: Types::STRING, length: 255, nullable: true, options: ['default' => null])]
    #[AutoAdminAssert\UniqueSlug]
    #[Groups(['slug_admin'])]
    protected ?string $slugAdmin = '';

    public function getSlugAdmin(): ?string
    {
        return $this->slugAdmin;
    }

    public function setSlugAdmin(?string $slugAdmin): void
    {
        $this->slugAdmin = $slugAdmin;
    }
}
