<?php

namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;


trait OpenGraphTrait
{
        /**
         * @ORM\Column(type="string", nullable=true)
         */
        protected $openGraphTitle;

        /**
         * @ORM\Column(type="text", nullable=true)
         */
        protected $openGraphDescription;

        /**
         * @ORM\Column(type="string", length=255, nullable=true)
         */
        protected $openGraphImage;

        /**
         * @Vich\UploadableField(mapping="images", fileNameProperty="openGraphImage")
         * @var File
         */
        protected $openGraphImageFile;


        public function getOpenGraphTitle(): ?string
        {
                return $this->openGraphTitle;
        }

        public function setOpenGraphTitle(string $openGraphTitle): self
        {
                $this->openGraphTitle = $openGraphTitle;

                return $this;
        }

        public function getOpenGraphDescription(): ?string
        {
                return $this->openGraphDescription;
        }

        public function setOpenGraphDescription(?string $openGraphDescription): self
        {
                $this->openGraphDescription = $openGraphDescription;

                return $this;
        }

        public function getOpenGraphImage(): ?string
        {
                return $this->openGraphImage;
        }

        public function setOpenGraphImage(?string $openGraphImage): self
        {
                $this->openGraphImage = $openGraphImage;

                return $this;
        }

        public function setOpenGraphImageFile(File $openGraphImageFile = null)
        {
                $this->openGraphImageFile = $openGraphImageFile;

                // VERY IMPORTANT:
                // It is required that at least one field changes if you are using Doctrine,
                // otherwise the event listeners won't be called and the file is lost
                if ($openGraphImageFile) {
                        // if 'updatedAt' is not defined in your entity, use another property
                        $this->updatedAt = new \DateTime('now');
                }
        }

        public function getOpenGraphImageFile()
        {
                return $this->openGraphImageFile ;
        }

}