<?php
namespace App\Entity\Core;
use App\Entity\Core\Session\Session;
use App\Entity\User\User;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use JsonSerializable;
#[ORM\Table('pretest_response')]
#[ORM\Entity(repositoryClass: PretestResponseRepository::class)]
class PretestResponse implements JsonSerializable
{
/**
* @var int
*/
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
private $id;
/**
* @var User
*/
#[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id')]
#[ORM\ManyToOne(targetEntity: User::class)]
private $student;
/**
* @var Session
*/
#[ORM\JoinColumn(name: 'session', referencedColumnName: 'id', onDelete: 'CASCADE')]
#[ORM\ManyToOne(targetEntity: Session::class, inversedBy: 'PretestResponses')]
private $session;
/**
* @var Mathproblem
*/
#[ORM\JoinColumn(name: 'mathproblem', referencedColumnName: 'id')]
#[ORM\ManyToOne(targetEntity: Mathproblem::class, fetch: 'EAGER')]
private $mathproblem;
/**
* @var Answer
*/
#[ORM\JoinColumn(name: 'answer', referencedColumnName: 'id', nullable: true, onDelete: 'RESTRICT')]
#[ORM\ManyToOne(targetEntity: Answer::class, fetch: 'EAGER')]
private $answer;
/**
* @var string
*/
#[ORM\Column(name: 'answerTxt', type: 'string', nullable: true)]
private $answerTxt;
/**
* @var DateTime
*/
#[ORM\Column(name: 'endTime', type: 'datetime', nullable: true)]
private $endTime = null;
/**
* @var DateTime
*/
#[ORM\Column(name: 'startTime', type: 'datetime')]
private $startTime;
#[ORM\Column(name: 'elo', type: 'decimal', precision: 9, scale: 5, unique: false, nullable: true)]
private $currentElo;
#[ORM\Column(name: 'elo_mp', type: 'decimal', precision: 9, scale: 5, unique: false, nullable: true)]
private $currentEloMP;
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set student.
*
* @param User $student
*
* @return PretestResponse
*/
public function setStudent($student)
{
$this->student = $student;
return $this;
}
/**
* Get student.
*
* @return User
*/
public function getStudent()
{
return $this->student;
}
/**
* Set Session.
*
* @param Session $session
*
* @return PretestResponse
*/
public function setSession($session)
{
$this->session = $session;
return $this;
}
/**
* Get Session.
*
* @return Session
*/
public function getSession()
{
return $this->session;
}
/**
* Set mathproblem.
*
* @param Mathproblem $mathproblem
*
* @return PretestResponse
*/
public function setMathproblem($mathproblem)
{
$this->mathproblem = $mathproblem;
return $this;
}
/**
* Get Mathproblem.
*
* @return Mathproblem
*/
public function getMathproblem()
{
return $this->mathproblem;
}
/**
* Set answer.
*
* @param Answer $answer
*
* @return PretestResponse
*/
public function setAnswer($answer)
{
$this->answer = $answer;
return $this;
}
/**
* @return Answer
*/
public function getAnswerChosen()
{
return $this->answer;
}
/**
* Set answer.
*
* @param string
*
* @return PretestResponse
*/
public function setAnswerTxt($answer)
{
$this->answerTxt = $answer;
return $this;
}
/**
* Get answerTxt.
*
* @return string
*/
public function getAnswerTxt()
{
return $this->answerTxt;
}
/**
* Get answer.
*
* @return Answer
*/
public function getAnswer()
{
return $this->answer;
}
/**
* @param DateTime $endTime
*/
public function setEndTime($endTime)
{
$this->endTime = $endTime;
}
/**
* @return DateTime
*/
public function getEndTime()
{
return $this->endTime;
}
/**
* @param DateTime $startTime
*/
public function setStartTime($startTime)
{
$this->startTime = $startTime;
}
/**
* @return DateTime
*/
public function getStartTime()
{
return $this->startTime;
}
public function getCurrentElo()
{
return $this->currentElo;
}
public function setCurrentElo($elo)
{
$this->currentElo = $elo;
}
public function getCurrentEloMP()
{
return $this->currentEloMP;
}
public function setCurrentEloMP($elo)
{
$this->currentEloMP = $elo;
}
public function jsonSerialize(): mixed
{
return [
"id" => $this->getId(),
"startTime" => $this->getStartTime(),
"session" => $this->getSession(),
"answerChosen" => $this->getAnswerChosen(),
"mathproblem" => $this->getMathproblem(),
"answer" => $this->getAnswer(),
"student" => $this->getStudent(),
"endTime" => $this->getEndTime(),
"answerTxt" => $this->getAnswerTxt(),
"currentElo" => $this->getCurrentElo(),
"currentEloMP" => $this->getCurrentEloMP(),
];
}
}