<?php

namespace AppBundle\Entity\Core;

use Doctrine\ORM\Mapping as ORM;
use Dunglas\ApiBundle\Annotation\Iri;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
use AppBundle\Entity\Traits\TimestampableEntity;
use AppBundle\Entity\Traits\CreatorUpdaterEntity;
use AppBundle\Entity\Organization\Organization;
use AppBundle\Entity\AccessAndFunction\Access;
use Gedmo\Mapping\Annotation as Gedmo;
use AppBundle\Annotation\DefaultField;

/**
 * (Non utilisé, à confirmer)
 *
 * @Iri("http://schema.org/Document")
 */
#[ORM\Entity(repositoryClass: 'AppBundle\Entity\Core\Repository\DocumentRepository')]
class Document
{
    use TimestampableEntity;
    use CreatorUpdaterEntity;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer')]
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'AUTO')]
    #[Groups(['document'])]
    private $id;
    /**
     * @var string
     */
    #[ORM\Column(type: 'string', length: 255, nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['document'])]
    private $name;
    /**
     * @Gedmo\Slug(fields={"name", "createDate"}, style="camel", separator="_", suffix="html.twig")
     */
    #[ORM\Column(length: 255, unique: true)]
    private $slug;
    /**
     * @var Access
     *
     * @DefaultField
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'documentAuthors')]
    #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
    #[ORM\JoinColumn(nullable: true)]
    #[Groups(['document'])]
    private $author;
    /**
     * @var Organization
     * @DefaultField
     */
    #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Organization\Organization', inversedBy: 'documents')]
    #[ORM\JoinColumn(nullable: true)]
    #[Groups(['document'])]
    private $organization;
    /**
     * @var string
     */
    #[ORM\Column(type: 'string', length: 255, nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['document'])]
    private $about;
    /**
     * @var string
     */
    #[ORM\Column(type: 'text', nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['document'])]
    private $headline;
    /**
     * @var string
     */
    #[ORM\Column(type: 'text', nullable: true)]
    #[Assert\Type(type: 'string')]
    #[Groups(['document'])]
    private $text;
    /**
     * @var bool
     */
    #[ORM\Column(type: 'boolean', options: ['default' => 0])]
    #[Assert\Type(type: 'boolean')]
    #[Assert\NotNull]
    #[Groups(['super_admin'])]
    private $isSystem = false;
    /**
     * @var bool
     */
    #[ORM\Column(type: 'boolean', options: ['default' => 0])]
    #[Assert\Type(type: 'boolean')]
    #[Assert\NotNull]
    #[Groups(['document'])]
    private $template = false;
    /**
     * The constructor
     * 
     * @param string $about
     * @param string $headline
     * @param string $text
     */
    public function __construct($about = null, $headline = null, $text = null) {
        $this->about = $about;
        $this->headline = $headline;
        $this->text = $text;
    }
    /**
     * Sets id.
     * 
     * @param int $id
     * 
     * @return $this
     */
    public function setId($id) {
        $this->id = $id;

        return $this;
    }
    /**
     * Gets id.
     * 
     * @return int
     */
    public function getId() {
        return $this->id;
    }
    /**
     * Sets name.
     * 
     * @param string $name
     * 
     * @return $this
     */
    public function setName($name) {
        $this->name = $name;

        return $this;
    }
    /**
     * Gets name.
     * 
     * @return string
     */
    public function getName() {
        return $this->name;
    }
    /**
     * Sets author.
     * 
     * @param Access $author
     * 
     * @return $this
     */
    public function setAuthor(Access $author) {
        $this->author = $author;

        return $this;
    }
    /**
     * Gets author.
     * 
     * @return Access
     */
    public function getAuthor() {
        return $this->author;
    }
    /**
     * Sets organization.
     * 
     * @param Organization $organization
     * 
     * @return $this
     */
    public function setOrganization(Organization $organization = null) {
        $this->organization = $organization;

        return $this;
    }
    /**
     * Gets organization.
     * 
     * @return Organization
     */
    public function getOrganization() {
        return $this->organization;
    }
    /**
     * Sets about.
     * 
     * @param string $about
     * 
     * @return $this
     */
    public function setAbout($about) {
        $this->about = $about;

        return $this;
    }
    /**
     * Gets about.
     * 
     * @return string
     */
    public function getAbout() {
        return $this->about;
    }
    /**
     * Sets headline.
     * 
     * @param string $headline
     * 
     * @return $this
     */
    public function setHeadline($headline) {
        $this->headline = $headline;
        return $this;
    }
    /**
     * Gets headline.
     * 
     * @return string
     */
    public function getHeadline() {
        return $this->headline;
    }
    /**
     * Set text
     *
     * @param string $text
     *
     * @return Template
     */
    public function setText($text)
    {
        $this->text = $text;

        return $this;
    }
    /**
     * Get text
     *
     * @return string
     */
    public function getText()
    {
        return $this->text;
    }
    /**
     * Sets isSystem.
     * 
     * @param bool $isSystem
     * 
     * @return $this
     */
    public function setIsSystem($isSystem) {
        $this->isSystem = $isSystem;

        return $this;
    }
    /**
     * Gets isSystem.
     * 
     * @return bool
     */
    public function getIsSystem() {
        return $this->isSystem;
    }
    /**
     * Is isSystem.
     * 
     * @return bool
     */
    public function isSystem() {
        return $this->isSystem;
    }
    /**
     * Sets is a template.
     * 
     * @param bool $template
     * 
     * @return $this
     */
    public function setTemplate($template) {
        $this->template = $template;

        return $this;
    }
    /**
     * Gets template.
     * 
     * @return bool
     */
    public function getTemplate() {
        return $this->template;
    }
    /**
     * Is a template
     * 
     * @return bool
     */
    public function isTemplate() {
        return $this->template;
    }
    /**
     * 
     * 
     * @return string
     */
    public function getSlug()
    {
        return $this->slug;
    }
}
