<?php
namespace App\Entity\ChannelUserData\Cursus;
use App\Repository\ChannelUserData\Cursus\AbstractCursusProgressionRepository;
use Doctrine\ORM\Mapping as ORM;
use DrosalysWeb\ObjectExtensions\Timestamp\Model\TimestampInterface;
use DrosalysWeb\ObjectExtensions\Timestamp\Model\TimestampTrait;
use DrosalysWeb\ObjectExtensions\Timestamp\Model\UpdatedTimestampInterface;
use DrosalysWeb\ObjectExtensions\Timestamp\Model\UpdateTimestampTrait;
use Symfony\Component\Serializer\Annotation as Serial;
#[
ORM\Entity(repositoryClass: AbstractCursusProgressionRepository::class),
ORM\Table(name: 'channel_user_data_cursus_progress'),
]
class AbstractCursusProgression implements TimestampInterface
{
use TimestampTrait;
#[ORM\Id, ORM\GeneratedValue, ORM\Column(type: 'integer')]
private ?int $id = null;
#[ORM\OneToOne(mappedBy: 'cursusProgression', targetEntity: AbstractCursus::class)]
private ?AbstractCursus $cursus = null;
#[ORM\Column(type: 'integer', nullable: true)]
#[Serial\Groups(groups: ['Async'])]
private ?int $eLearningPercentage = null;
#[ORM\Column(type: 'integer', nullable: true)]
#[Serial\Groups(groups: ['Async'])]
private ?int $eventsPercentage = null;
#[ORM\Column(type: 'integer', nullable: true)]
#[Serial\Groups(groups: ['Async'])]
private ?int $totalPercentage = null;
#[ORM\Column(type: 'integer', nullable: true)]
#[Serial\Groups(groups: ['Async'])]
private ?int $eLearningTotalTime = null;
#[ORM\Column(type: 'integer', nullable: true)]
#[Serial\Groups(groups: ['Async'])]
private ?int $eventTotalTime = null;
#[Serial\Groups(groups: ['Async'])]
public function getTotalTime(): int
{
return ($this->getEventTotalTime() ?? 0) + ($this->getELearningTotalTime() ?? 0);
}
public function getId(): ?int
{
return $this->id;
}
public function getCursus(): ?AbstractCursus
{
return $this->cursus;
}
public function setCursus(?AbstractCursus $cursus): AbstractCursusProgression
{
$this->cursus = $cursus;
$this->cursus->setCursusProgression($this);
return $this;
}
public function getELearningPercentage(): ?int
{
return $this->eLearningPercentage;
}
public function setELearningPercentage(?int $eLearningPercentage): AbstractCursusProgression
{
$this->eLearningPercentage = $eLearningPercentage;
return $this;
}
public function getEventsPercentage(): ?int
{
return $this->eventsPercentage;
}
public function setEventsPercentage(?int $eventsPercentage): AbstractCursusProgression
{
$this->eventsPercentage = $eventsPercentage;
return $this;
}
public function getTotalPercentage(): ?int
{
return $this->totalPercentage;
}
public function setTotalPercentage(?int $totalPercentage): AbstractCursusProgression
{
$this->totalPercentage = $totalPercentage;
return $this;
}
public function getELearningTotalTime(): ?int
{
return $this->eLearningTotalTime;
}
public function setELearningTotalTime(?int $eLearningTotalTime): AbstractCursusProgression
{
$this->eLearningTotalTime = $eLearningTotalTime;
return $this;
}
public function getEventTotalTime(): ?int
{
return $this->eventTotalTime;
}
public function setEventTotalTime(?int $eventTotalTime): AbstractCursusProgression
{
$this->eventTotalTime = $eventTotalTime;
return $this;
}
}