<?php

namespace App\MessageTemplates;

use App\ValueObjects\EmailAddress;

class activationCodeTemplate extends MessageTemplate {

    public static function createForUser(EmailAddress $emailAddress, string $activationCode) : activationCodeTemplate {
        $template = new activationCodeTemplate();
        $template->composeMessage($emailAddress, $activationCode);
        return $template;
    }

    public function __construct() {
        $this->subject = "Dein Aktivierungscode";
    }

    public function composeMessage(EmailAddress $emailAddress, string $activationCode): void {
        $this->message = "Dein Aktivierungscode lautet: {$activationCode}" . PHP_EOL .
        "Gib diesen zusammen mit der Mailadresse {$emailAddress->getValue()} ein.";
    }
}
