<?php
namespace App\Entity;
use App\Entity\Traits\Timestampable;
use App\Repository\AgendaElementRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation\Groups;
#[ORM\HasLifecycleCallbacks]
#[ORM\Entity(repositoryClass: AgendaElementRepository::class)]
class AgendaElement
{
use Timestampable;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups(['getAgenda'])]
private ?int $id = null;
#[ORM\Column(type: Types::TIME_MUTABLE)]
#[Groups(['getAgenda'])]
private ?\DateTimeInterface $startAt = null;
#[ORM\Column(type: Types::TIME_MUTABLE)]
#[Groups(['getAgenda'])]
private ?\DateTimeInterface $endAt = null;
#[ORM\Column(length: 255)]
#[Groups(['getAgenda'])]
private ?float $duration = null;
#[ORM\Column(length: 255, nullable: true)]
#[Groups(['getAgenda'])]
private ?int $other = null;
#[ORM\ManyToOne(inversedBy: 'agendaElements')]
#[Groups(['getAgenda'])]
private ?Subject $subject = null;
#[ORM\ManyToOne(inversedBy: 'elements')]
#[ORM\JoinColumn(nullable: false)]
private ?AgendaDay $agendaDay = null;
#[ORM\ManyToOne(inversedBy: 'agendaElements')]
#[ORM\JoinColumn(nullable: false)]
private ?User $author = null;
#[ORM\Column]
private ?bool $active = null;
#[ORM\Column(nullable: true)]
private ?\DateTimeImmutable $descativatedAt = null;
#[ORM\OneToMany(mappedBy: 'agendaElement', targetEntity: ProfTime::class)]
private Collection $profTimes;
#[ORM\ManyToOne(inversedBy: 'agendaElements')]
#[ORM\JoinColumn(nullable: false)]
private ?School $school = null;
#[ORM\ManyToOne(inversedBy: 'agendaElements')]
#[ORM\JoinColumn(nullable: false)]
private ?SchoolYear $year = null;
#[ORM\ManyToOne(inversedBy: 'agendaElements')]
#[ORM\JoinColumn(nullable: false)]
private ?TheClass $classe = null;
public function __construct()
{
$this->profTimes = new ArrayCollection();
}
public function __toString()
{
return $this->id;
}
public function getId(): ?int
{
return $this->id;
}
public function getStartAt(): ?\DateTimeInterface
{
return $this->startAt;
}
public function setStartAt(\DateTimeInterface $startAt): static
{
$this->startAt = $startAt;
return $this;
}
public function getEndAt(): ?\DateTimeInterface
{
return $this->endAt;
}
public function setEndAt(\DateTimeInterface $endAt): static
{
$this->endAt = $endAt;
return $this;
}
public function getDuration(): ?float
{
return $this->duration;
}
public function setDuration(float $duration): static
{
$this->duration = $duration;
return $this;
}
public function getOther(): ?int
{
return $this->other;
}
public function setOther(?int $other): static
{
$this->other = $other;
return $this;
}
public function getSubject(): ?Subject
{
return $this->subject;
}
public function setSubject(?Subject $subject): static
{
$this->subject = $subject;
return $this;
}
public function getAgendaDay(): ?AgendaDay
{
return $this->agendaDay;
}
public function setAgendaDay(?AgendaDay $agendaDay): static
{
$this->agendaDay = $agendaDay;
return $this;
}
public function getAuthor(): ?User
{
return $this->author;
}
public function setAuthor(?User $author): static
{
$this->author = $author;
return $this;
}
public function isActive(): ?bool
{
return $this->active;
}
public function setActive(bool $active): static
{
$this->active = $active;
return $this;
}
public function getDescativatedAt(): ?\DateTimeImmutable
{
return $this->descativatedAt;
}
public function setDescativatedAt(?\DateTimeImmutable $descativatedAt): static
{
$this->descativatedAt = $descativatedAt;
return $this;
}
/**
* @return Collection<int, ProfTime>
*/
public function getProfTimes(): Collection
{
return $this->profTimes;
}
public function addProfTime(ProfTime $profTime): static
{
if (!$this->profTimes->contains($profTime)) {
$this->profTimes->add($profTime);
$profTime->setAgendaElement($this);
}
return $this;
}
public function removeProfTime(ProfTime $profTime): static
{
if ($this->profTimes->removeElement($profTime)) {
// set the owning side to null (unless already changed)
if ($profTime->getAgendaElement() === $this) {
$profTime->setAgendaElement(null);
}
}
return $this;
}
public function getSchool(): ?School
{
return $this->school;
}
public function setSchool(?School $school): static
{
$this->school = $school;
return $this;
}
public function getYear(): ?SchoolYear
{
return $this->year;
}
public function setYear(?SchoolYear $year): static
{
$this->year = $year;
return $this;
}
public function getClasse(): ?TheClass
{
return $this->classe;
}
public function setClasse(?TheClass $classe): static
{
$this->classe = $classe;
return $this;
}
}