<?php

namespace AutoAdmin\Bundle\BrickBuilder\Exception;

use AutoAdmin\Bundle\BrickBuilder\Model\BrickInterface;

class BadSettingFormatException extends \Exception
{
    public function __construct(
        protected BrickInterface $brick,
        string $key,
        string $appendMsg = ''
    ) {
        $message = sprintf(
            'Brick setting error, encountered value that is not a string. '.
            '[type: %s] [id: %s] [setting: %s]%s',
            $this->brick->getType(),
            $this->brick->getId(),
            $key,
            $appendMsg ? (' '.$appendMsg) : ''
        );
        parent::__construct($message, 0, null);
    }
}