<?php

declare(strict_types=1);

/*
 * This file is part of the Ferienpass package.
 *
 * (c) Richard Henkenjohann <richard@ferienpass.online>
 *
 * For more information visit the project website <https://ferienpass.online>
 * or the documentation under <https://docs.ferienpass.online>.
 */

namespace Ferienpass\CoreBundle\Message;

/**
 * Sends the notification email for one comment to one external recipient (a host
 * or a parent/account). Dispatched once per resolved recipient; all recipients
 * of the same comment share a Postausgang group via {@see groupedBy()}.
 */
class CommentPosted implements LoggableMessageInterface, GroupedMessageInterface
{
    public function __construct(
        private readonly string $commentUuid,
        private readonly string $email,
        private readonly ?string $name = null,
        private readonly string $kind = 'host',
        /**
         * Absolute admin URLs, resolved at dispatch time (the worker has no
         * request host). Only applied for admin/host recipients — parents and
         * other non-admin accounts never receive an /admin link.
         */
        private readonly ?string $actionUrl = null,
        private readonly ?string $settingsUrl = null,
        /** The in-app notify reason (mention/reply/…) driving the header verb. */
        private readonly ?string $reason = null,
    ) {
    }

    public function getCommentUuid(): string
    {
        return $this->commentUuid;
    }

    public function getEmail(): string
    {
        return $this->email;
    }

    public function getName(): ?string
    {
        return $this->name;
    }

    public function getKind(): string
    {
        return $this->kind;
    }

    public function getActionUrl(): ?string
    {
        return $this->actionUrl;
    }

    public function getSettingsUrl(): ?string
    {
        return $this->settingsUrl;
    }

    public function getReason(): ?string
    {
        return $this->reason;
    }

    public function getRelated(): array
    {
        return [];
    }

    public function groupedBy(): ?string
    {
        return $this->commentUuid;
    }
}
