<?php

declare(strict_types=1);

/*
 * Chill is a software for social workers
 *
 * For the full copyright and license information, please view
 * the LICENSE file that was distributed with this source code.
 */

namespace Chill\MainBundle\Notification\Email\NotificationEmailMessages;

use Chill\MainBundle\Entity\Notification;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Entity\UserGroup;

readonly class SendImmediateNotificationEmailMessage
{
    private int $notificationId;

    private ?int $userId;

    private ?int $userGroupId;

    public function __construct(
        Notification $notification,
        UserGroup|User $addressee,
    ) {
        $this->notificationId = $notification->getId();

        if ($addressee instanceof User) {
            $this->userId = $addressee->getId();
            $this->userGroupId = null;
        } else {
            $this->userGroupId = $addressee->getId();
            $this->userId = null;
        }
    }

    public function getNotificationId(): int
    {
        return $this->notificationId;
    }

    public function getUserId(): ?int
    {
        return $this->userId;
    }

    public function getUserGroupId(): ?int
    {
        return $this->userGroupId;
    }
}
