<?php

declare(strict_types=1);

namespace MyCustomizer\WooCommerce\Connector\Libs\Admin;

use MyCustomizer\WooCommerce\Connector\Libs\Admin\MczrMessageType;

class MczrDiagnosticMessage
{
    /** @var array<int, array{message: string, type: string}> */
    private $messageList = [];

    public function getMessageList()
    {
        return $this->messageList;
    }

    public function addMessage(string $message, string $type = MczrMessageType::INFO)
    {
        if (!MczrMessageType::isValid($type)) {
            $type = MczrMessageType::INFO;
        }

        $this->messageList[] = [
            'message' => $message,
            'type' => $type,
        ];

        return $this;
    }
}
