@props([
    'type' => 'info',
    'message' => null,
    'dismissible' => true,
])

@php
    $validTypes = ['primary', 'secondary', 'success', 'danger', 'warning', 'info'];
    $alertType = in_array($type, $validTypes, true) ? $type : 'info';
@endphp

<div {{ $attributes->merge(['class' => 'alert alert-' . $alertType . ($dismissible ? ' alert-dismissible fade show' : ''), 'role' => 'alert']) }}>
    @if ($message)
        {!! $message !!}
    @else
        {{ $slot }}
    @endif

    @if ($dismissible)
        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
    @endif
</div>
