<?php
namespace App\Entity\Core\Peer;
use App\Entity\Core\ImageReference;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use JsonSerializable;
#[ORM\Table('peer_mathproblem')]
#[ORM\Entity(repositoryClass: PeerMathproblemRepository::class)]
class PeerMathproblem implements JsonSerializable
{
#[ORM\Column(type: 'integer')]
#[ORM\Id]
#[ORM\GeneratedValue]
private int $id;
#[ORM\JoinColumn(name: 'peer_theme_id')]
#[ORM\ManyToOne(targetEntity: PeerTheme::class, inversedBy: 'peerMathproblems')]
private PeerTheme $peerTheme;
#[ORM\OneToMany(targetEntity: PeerUnit::class, mappedBy: 'peerMathproblem')]
private Collection $peerUnits;
#[ORM\Column(type: 'text')]
private string $title;
#[ORM\Column(type: 'text')]
private string $description;
#[ORM\Column(name: 'student_hint', type: 'text', nullable: true)]
private ?string $studentHint;
#[ORM\Column(name: 'teacher_hint', type: 'text', nullable: true)]
private ?string $teacherHint;
#[ORM\Column(name: 'feedback_stage1', type: 'text', nullable: true)]
private ?string $feedbackStage1;
#[ORM\Column(name: 'feedback_stage2', type: 'text', nullable: true)]
private ?string $feedbackStage2;
#[ORM\Column(name: 'feedback_stage3', type: 'text', nullable: true)]
private ?string $feedbackStage3;
/**
* level 1 = 7th grade, level 2 = 8th grade, level3 = 9+10th grade
*/
#[ORM\Column(type: 'integer')]
private int $level;
#[ORM\Column(name: 'student_hint_video', type: 'text', nullable: true)]
private ?string $studentHintVideo;
/**
* The new image layout for CMS and API.
*/
#[ORM\JoinColumn(name: 'image_reference', referencedColumnName: 'id', nullable: true)]
#[ORM\OneToOne(targetEntity: ImageReference::class)]
private ?ImageReference $imageReference;
/**
* The new image layout for CMS and API.
*/
#[ORM\JoinColumn(name: 'teacher_hint_image_reference', referencedColumnName: 'id', nullable: true)]
#[ORM\OneToOne(targetEntity: ImageReference::class)]
private ?ImageReference $teacherHintImageReference;
/**
* The new image layout for CMS and API.
*/
#[ORM\JoinColumn(name: 'student_hint_image_reference', referencedColumnName: 'id', nullable: true)]
#[ORM\OneToOne(targetEntity: ImageReference::class)]
private ?ImageReference $studentHintImageReference;
public function __construct()
{
$this->peerUnits = new ArrayCollection();
$this->imageReference = null;
}
public function getTeacherHintImageReference(): ?ImageReference
{
return $this->teacherHintImageReference;
}
public function setTeacherHintImageReference(?ImageReference $teacherHintImageReference): void
{
$this->teacherHintImageReference = $teacherHintImageReference;
}
public function getStudentHintImageReference(): ?ImageReference
{
return $this->studentHintImageReference;
}
public function setStudentHintImageReference(?ImageReference $studentHintImageReference): void
{
$this->studentHintImageReference = $studentHintImageReference;
}
public function getImageReference(): ?ImageReference
{
return $this->imageReference;
}
public function setImageReference(?ImageReference $imageReference): void
{
$this->imageReference = $imageReference;
}
public function getId(): int
{
return $this->id;
}
public function getPeerTheme(): PeerTheme
{
return $this->peerTheme;
}
public function setPeerTheme(PeerTheme $peerTheme)
{
$this->peerTheme = $peerTheme;
}
public function getDescription(): string
{
return $this->description;
}
public function setDescription(string $description)
{
$this->description = $description;
}
/**
* @return ArrayCollection | PeerUnit[]
*/
public function getPeerUnits(): Collection
{
return $this->peerUnits;
}
public function getTitle(): string
{
return $this->title;
}
public function setTitle(string $title): void
{
$this->title = $title;
}
public function getStudentHint(): ?string
{
return $this->studentHint;
}
public function setStudentHint(string $studentHint): void
{
$this->studentHint = $studentHint;
}
public function getTeacherHint(): ?string
{
return $this->teacherHint;
}
public function setTeacherHint(string $teacherHint): void
{
$this->teacherHint = $teacherHint;
}
public function getLevel(): int
{
return $this->level;
}
public function setLevel(int $level): void
{
$this->level = $level;
}
public function jsonSerialize(): mixed
{
return [
"id" => $this->id,
"title" => $this->title,
"description" => $this->description,
"studentHint" => $this->studentHint,
"teacherHint" => $this->teacherHint,
"studentHintVideo" => $this->studentHintVideo,
"level" => $this->level,
];
}
public function getFeedbackStage1(): ?string
{
return $this->feedbackStage1;
}
public function setFeedbackStage1(?string $feedbackStage1): void
{
$this->feedbackStage1 = $feedbackStage1;
}
public function getFeedbackStage2(): ?string
{
return $this->feedbackStage2;
}
public function setFeedbackStage2(?string $feedbackStage2): void
{
$this->feedbackStage2 = $feedbackStage2;
}
public function getFeedbackStage3(): ?string
{
return $this->feedbackStage3;
}
public function setFeedbackStage3(?string $feedbackStage3): void
{
$this->feedbackStage3 = $feedbackStage3;
}
public function getStudentHintVideo(): ?string
{
return $this->studentHintVideo;
}
public function setStudentHintVideo(?string $studentHintVideo): void
{
$this->studentHintVideo = $studentHintVideo;
}
/** helper functions **/
public function getImagePath(): string
{
return $this->imageReference?->getFullMediaPath() ?? '';
}
public function getStudentHintImagePath(): string
{
return $this->studentHintImageReference?->getFullMediaPath() ?? '';
}
public function getTeacherHintImagePath(): string
{
return $this->teacherHintImageReference?->getFullMediaPath() ?? '';
}
public function getImage(): string {
return $this->getImagePath();
}
public function getStudentHintImage(): string {
return $this->getStudentHintImagePath();
}
public function getTeacherHintImage(): string {
return $this->getTeacherHintImagePath();
}
}