<?php
/**
 * Interacts With Banner Trait
 *
 * @version     1.0.$Revision:$
 * @version     SVN: $Id:$
 * @package     bplan-base/globals
 * @subpackage  Traits
 * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
 * @copyright   Copyright (C) 2025, 2026 bplan-solutions GmbH & Co. KG <https://www.bplan-solutions.de/>
 * /Δ\
 */

namespace BplanBase\Globals\Traits;


/**
 * Interacts With Banner Trait
 *
 * Drop-in replacement for Laravel\Jetstream\InteractsWithBanner.
 * Dispatches the same "banner-message" Livewire event with identical
 * style values, keeping all existing Livewire components compatible.
 *
 * @version     1.0.0 / 2026-04-26
 * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
 */
trait InteractsWithBanner
{


/* +++ OBJECT METHODS +++ +++++++++++++++++++++++++++++++++++++++++++++++++++ */


    /**
     * @param       string $message
     *
     * @return      void
     *
     * @version     1.0.0 / 2026-04-26
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    protected function banner(string $message): void
    {
        $this->dispatch('banner-message',
            style: 'success',
            message: $message,
        );
    } // banner()


    /**
     * @param       string $message
     *
     * @return      void
     *
     * @version     1.0.0 / 2026-04-26
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    protected function dangerBanner(string $message): void
    {
        $this->dispatch('banner-message',
            style: 'danger',
            message: $message,
        );
    } // dangerBanner()


    /**
     * @param       string $message
     *
     * @return      void
     *
     * @version     1.0.0 / 2026-04-26
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    protected function warningBanner(string $message): void
    {
        $this->dispatch('banner-message',
            style: 'warning',
            message: $message,
        );
    } // warningBanner()


} // trait InteractsWithBanner {}
