<?phpnamespace Roothirsch\Tuer24Bundle\Entity;use Doctrine\ORM\Mapping as ORM;use Roothirsch\Tuer24Bundle\Repository\Tuer24NotificationPreferenceRepository;#[ORM\Entity(repositoryClass: Tuer24NotificationPreferenceRepository::class)]#[ORM\Table(name: 'roothirsch_tuer24_notification_preference')]#[ORM\HasLifecycleCallbacks]class Tuer24NotificationPreference{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column] private ?int $userId = null; #[ORM\Column(type: 'boolean', options: ['default' => true])] private bool $orderCreated = true; #[ORM\Column(type: 'boolean', options: ['default' => true])] private bool $orderStatusChanged = true; #[ORM\Column(type: 'boolean', options: ['default' => true])] private bool $paymentConfirmed = true; #[ORM\Column(type: 'boolean', options: ['default' => true])] private bool $paymentFailed = true; #[ORM\Column(type: 'datetime')] private ?\DateTime $createdAt = null; #[ORM\Column(type: 'datetime')] private ?\DateTime $updatedAt = null; public function __construct() { $this->createdAt = new \DateTime(); $this->updatedAt = new \DateTime(); } #[ORM\PreUpdate] public function preUpdate(): void { $this->updatedAt = new \DateTime(); } public function getId(): ?int { return $this->id; } public function getUserId(): ?int { return $this->userId; } public function setUserId(?int $userId): self { $this->userId = $userId; return $this; } public function isOrderCreated(): bool { return $this->orderCreated; } public function setOrderCreated(bool $orderCreated): self { $this->orderCreated = $orderCreated; return $this; } public function isOrderStatusChanged(): bool { return $this->orderStatusChanged; } public function setOrderStatusChanged(bool $orderStatusChanged): self { $this->orderStatusChanged = $orderStatusChanged; return $this; } public function isPaymentConfirmed(): bool { return $this->paymentConfirmed; } public function setPaymentConfirmed(bool $paymentConfirmed): self { $this->paymentConfirmed = $paymentConfirmed; return $this; } public function isPaymentFailed(): bool { return $this->paymentFailed; } public function setPaymentFailed(bool $paymentFailed): self { $this->paymentFailed = $paymentFailed; return $this; } public function getCreatedAt(): ?\DateTime { return $this->createdAt; } public function setCreatedAt(\DateTime $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getUpdatedAt(): ?\DateTime { return $this->updatedAt; } public function setUpdatedAt(\DateTime $updatedAt): self { $this->updatedAt = $updatedAt; return $this; } /** * Check if a specific notification type is enabled */ public function isNotificationEnabled(string $type): bool { switch ($type) { case 'order_created': return $this->orderCreated; case 'order_status_changed': return $this->orderStatusChanged; case 'payment_confirmed': return $this->paymentConfirmed; case 'payment_failed': return $this->paymentFailed; default: return true; } }}