<?php
namespace App\Entity\ChannelUserData\Activity;
use App\Enum\ChannelUserData\Activity\MeetingActivityContactTypeEnum;
use App\Enum\ChannelUserData\Activity\MeetingActivityModalityEnum;
use App\Repository\ChannelUserData\Activity\CommentActivityRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serial;
use Symfony\Component\Validator\Constraints as Assert;
#[
ORM\Entity(repositoryClass: CommentActivityRepository::class),
ORM\Table(name: 'channel_user_data_meeting_activity'),
]
class MeetingActivity extends AbstractActivity
{
#[ORM\Column(type: 'integer', nullable: true)]
#[Serial\Groups(['activity:get', 'activity:post'])]
#[
Assert\Choice(
callback: [MeetingActivityContactTypeEnum::class, 'getChoices'],
message: 'meetingActivity.contactType.Choice.message',
groups: ['activity:post']
)
]
private ?int $contactType = null;
#[ORM\Column(type: 'integer', nullable: true)]
#[Serial\Groups(['activity:get', 'activity:post'])]
#[Assert\GreaterThanOrEqual(value: 0, message: 'meetingActivity.duration.GreaterThanOrEqual.message', groups: ['activity:post'])]
private ?int $duration = null;
#[ORM\Column(type: 'integer', nullable: true)]
#[Serial\Groups(['activity:get', 'activity:post'])]
#[
Assert\Choice(
callback: [MeetingActivityModalityEnum::class, 'getChoices'],
message: 'meetingActivity.modality.Choice.message',
groups: ['activity:post']
)
]
private ?int $modality = null;
/** @var int[] $objective */
#[ORM\Column(type: 'simple_array', nullable: true)]
#[Serial\Groups(['activity:get', 'activity:post'])]
#[
Assert\NotBlank(
message: 'meetingActivity.objectives.Choice.message',
groups: ['activity:post'],
)
]
private array $objectives = [];
#[ORM\Column(type: 'text', length: 10000, nullable: true)]
#[Assert\NotBlank(groups: ['activity:post'])]
#[Assert\Length(min: 20, max: 10000, groups: ['activity:post'])]
#[Serial\Groups(['activity:get', 'activity:post'])]
private ?string $content = null;
#[ORM\Column(type: 'text', length: 10000, nullable: true)]
#[Serial\Groups(['activity:get', 'activity:post'])]
#[Assert\Length(max: 10000, groups: ['activity:post'])]
private ?string $planContent = null;
#[Serial\Groups(['activity:get'])]
public function getContentNl2br(): string
{
return $this->content ? nl2br($this->content) : '';
}
#[Serial\Groups(['activity:get'])]
public function getPlanContentNl2br(): string
{
return $this->planContent ? nl2br($this->planContent) : '';
}
public function getContactType(): ?int
{
return $this->contactType;
}
public function setContactType(?int $contactType): MeetingActivity
{
$this->contactType = $contactType;
return $this;
}
public function getDuration(): ?int
{
return $this->duration;
}
public function setDuration(?int $duration): MeetingActivity
{
$this->duration = $duration;
return $this;
}
public function getModality(): ?int
{
return $this->modality;
}
public function setModality(?int $modality): MeetingActivity
{
$this->modality = $modality;
return $this;
}
public function getObjectives(): array
{
return $this->objectives;
}
public function setObjectives(array $objectives): MeetingActivity
{
$this->objectives = $objectives;
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(?string $content): MeetingActivity
{
$this->content = $content;
return $this;
}
public function getPlanContent(): ?string
{
return $this->planContent;
}
public function setPlanContent(?string $planContent): MeetingActivity
{
$this->planContent = $planContent;
return $this;
}
}