<?php

namespace App\Entity;

use App\Repository\EvenementRepository;
use Doctrine\ORM\Mapping as ORM;
use ApiPlatform\Core\Annotation\ApiResource;
use Symfony\Component\Serializer\Annotation\Groups;
use ApiPlatform\Core\Annotation\ApiFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;

/**
 * @ORM\Entity(repositoryClass=EvenementRepository::class)
 * @ORM\Table(name="`evenement`")
 * @ApiResource(
 * normalizationContext={"groups"={"read:Evenement"}},
 * denormalizationContext={"groups"={"write:Evenement"}}
 * )
 */
class Evenement
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     * @Groups({"read:Evenement","read:Animal"})
     */
    private $id;

    /**
     * @ORM\Column(type="datetime")
     * @Groups({"read:Evenement","write:Evenement","read:Animal"})
     */
    private $date;

    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     * @Groups({"read:Evenement","write:Evenement","read:Animal"})
     */
    private $description;

    /**
     * @ORM\ManyToOne(targetEntity=Typeevent::class, inversedBy="evenements")
     * @Groups({"read:Evenement","write:Evenement","read:Animal"})
     */
    private $type;

    /**
     * @ORM\ManyToOne(targetEntity=Animal::class, inversedBy="evenements")
     * @Groups({"read:Evenement","write:Evenement"})
     */
    private $animal;

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getDate(): ?\DateTimeInterface
    {
        return $this->date;
    }

    public function setDate(\DateTimeInterface $date): self
    {
        $this->date = $date;

        return $this;
    }

    public function getDescription(): ?string
    {
        return $this->description;
    }

    public function setDescription(?string $description): self
    {
        $this->description = $description;

        return $this;
    }

    public function getType(): ?Typeevent
    {
        return $this->type;
    }

    public function setType(?Typeevent $type): self
    {
        $this->type = $type;

        return $this;
    }

    public function getAnimal(): ?Animal
    {
        return $this->animal;
    }

    public function setAnimal(?Animal $animal): self
    {
        $this->animal = $animal;

        return $this;
    }
}
