@props(['status', 'size' => 'sm'])

@php
$label = match($status) {
    'active'         => 'Active',
    'fallow'         => 'Fallow',
    'treatment'      => 'Treatment',
    'harvest_ready'  => 'Harvest Ready',
    'decommissioned' => 'Decommissioned',
    'open'           => 'Open',
    'closed'         => 'Closed',
    'paid'           => 'Paid',
    'partial'        => 'Partial',
    'pending'        => 'Pending',
    'safe'           => 'Safe',
    'warning'        => 'Warning',
    'danger'         => 'Danger',
    default          => ucwords(str_replace('_', ' ', $status)),
};

$colours = match($status) {
    'active', 'open', 'paid', 'safe'   => 'bg-green-100 text-green-800 ring-green-200',
    'fallow', 'closed'                  => 'bg-gray-100 text-gray-700 ring-gray-200',
    'treatment', 'partial', 'warning'   => 'bg-amber-100 text-amber-800 ring-amber-200',
    'harvest_ready'                     => 'bg-teal-100 text-teal-800 ring-teal-200',
    'decommissioned', 'danger'          => 'bg-red-100 text-red-800 ring-red-200',
    'pending'                           => 'bg-orange-100 text-orange-800 ring-orange-200',
    default                             => 'bg-gray-100 text-gray-700 ring-gray-200',
};

$sizeClasses = $size === 'xs' ? 'px-1.5 py-0.5 text-xs' : 'px-2 py-1 text-xs';
@endphp

<span class="inline-flex items-center rounded-full font-medium ring-1 ring-inset {{ $colours }} {{ $sizeClasses }}">
    {{ $label }}
</span>
