<?php

namespace App\Model\Entities;

use App\Model\Entities\Security\User;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="Image")
 */
class Image extends BaseNamedRecord
{
    const UPLOADED = 'uploaded';
    const PUBLISHED = 'published';

    /**
     * @ORM\Column(type="string", unique=true)
     */
    protected $fileName;

    public function __construct(User $createdBy)
    {
        parent::__construct($createdBy);

        $this->setState(self::UPLOADED);
    }

    /**
     * @return string
     */
    public function getFileName() : string
    {
        return $this->fileName;
    }

    /**
     * @param string $fileName
     */
    public function setFileName(string $fileName)
    {
        $this->fileName = $fileName;
    }

    protected function getValidStates() : array
    {
        $states =  parent::getValidStates();
        $states[] = self::UPLOADED;
        $states[] = self::PUBLISHED;

        return $states;
    }


}