<?php

declare( strict_types=1 );

namespace Soft_Tehnica\Freya_Sync_Service\Data;

class Notification
{

    public string $type;
    public string $message;

    public function __construct(
        string $type,
        string $message
    ) {
        assert( $type === 'success' || $type === 'error' || $type === 'warning', "Invalid notification type $type" );

        $this->type    = $type;
        $this->message = $message;
    }

    public function render(): void
    {
        $class = sprintf( 'fss-notification-%s', $this->type );

        ?>
        <div class="fss-notification-container <?php echo $class; ?>">
            <p><?php echo $this->message; ?></p>
        </div>
        <?php
    }
}
