<?php


namespace AutoAdmin\Bundle\Content\Entity\Traits;

use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;

trait StatePublishableTrait
{
    #[ORM\Column(name: 'publishable_state', type: Types::STRING, length: 25, nullable: true)]
    #[Groups(['publishable'])]
    protected ?string $state = 'draft';

    public function isPublishable(): bool
    {
        return $this->state === 'published';
    }

    public function setPublishable(?string $publishableState): void
    {
        $this->state = $publishableState;
    }

    public function getState(): ?string
    {
        return $this->state;
    }

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