<?php

namespace AppBundle\Entity\Core;

use AppBundle\Annotation\ExportSplitFields;
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;

/**
 * Enum des catégories d'évènements
 *
 * @Iri("http://schema.org/Categories")
 */
#[ORM\Entity]
class Categories
{
    use TimestampableEntity;
    use CreatorUpdaterEntity;
    /**
     * @var int
     */
    #[ORM\Column(type: 'integer')]
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'AUTO')]
    #[Groups(['categories', 'event_details'])]
    private $id;
    /**
     * @var Familly
     */
    #[ORM\ManyToOne(targetEntity: 'Familly')]
    #[ORM\JoinColumn(nullable: false)]
    #[Assert\NotNull]
    #[Groups(['categories', 'categories_reference'])]
    private $familly;
    /**
     * @var Subfamilly
     */
    #[ORM\ManyToOne(targetEntity: 'Subfamilly')]
    #[ORM\JoinColumn(nullable: false)]
    #[Assert\NotNull]
    #[Groups(['categories', 'categories_reference'])]
    private $subfamilly;
    /**
     * @var Gender
     */
    #[ORM\ManyToOne(targetEntity: 'Gender')]
    #[ORM\JoinColumn(nullable: false)]
    #[Assert\NotNull]
    #[Groups(['categories', 'categories_reference', 'event_details_categories'])]
    private $gender;
    /**
     * @var string
     * @ExportSplitFields({"familly.name","subfamilly.name","gender.name"})
     */
    #[Groups(['categories', 'template'])]
    private $fullLabelTemplate;
    /**
     * 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 familly.
     * 
     * @param Familly $familly
     * 
     * @return $this
     */
    public function setFamilly(Familly $familly)
    {
        $this->familly = $familly;

        return $this;
    }
    /**
     * Gets familly.
     * 
     * @return Familly
     */
    public function getFamilly()
    {
        return $this->familly;
    }
    /**
     * Sets subfamilly.
     * 
     * @param Subfamilly $subfamilly
     * 
     * @return $this
     */
    public function setSubfamilly(Subfamilly $subfamilly)
    {
        $this->subfamilly = $subfamilly;

        return $this;
    }
    /**
     * Gets subfamilly.
     * 
     * @return Subfamilly
     */
    public function getSubfamilly()
    {
        return $this->subfamilly;
    }
    /**
     * Sets gender.
     * 
     * @param Gender $gender
     * 
     * @return $this
     */
    public function setGender(Gender $gender)
    {
        $this->gender = $gender;

        return $this;
    }
    /**
     * Gets gender.
     * 
     * @return Gender
     */
    public function getGender()
    {
        return $this->gender;
    }
    /**
     * Gets full label.
     *
     * @return string
     */
    public function getFullLabelTemplate()
    {

        return [
            $this->getFamilly()->getName(),
            $this->getSubfamilly()->getName(),
            $this->getGender()->getName()
        ];
    }
}
