@php /** @var \App\Models\ClientSoftwareLicense $softwareLicense */ @endphp
<div class="card mb-3 border-0 shadow-sm">
    <div class="card-body">
        <h5 class="mb-3">
            <i class="fas fa-key me-2 text-primary"></i>{{ __('store.software_license_title') }}
            @if($softwareLicense->isLifetime())
                <span class="badge bg-info ms-2">{{ __('store.software_lifetime') }}</span>
            @endif
        </h5>

        <dl class="row mb-3">
            <dt class="col-sm-3">{{ __('store.software_product_label') }}</dt>
            <dd class="col-sm-9">{{ $softwareLicense->product_label ?? '—' }}</dd>

            <dt class="col-sm-3">{{ __('store.software_status') }}</dt>
            <dd class="col-sm-9">
                @if($softwareLicense->isRevoked())
                    <span class="badge bg-danger">{{ __('store.software_status_revoked') }}</span>
                @elseif($softwareLicense->isExpired())
                    <span class="badge bg-secondary">{{ __('store.software_status_expired') }}</span>
                @elseif($softwareLicense->issued)
                    <span class="badge bg-success">{{ __('store.software_status_issued') }}</span>
                @else
                    <span class="badge bg-warning text-dark">{{ __('store.software_status_pending') }}</span>
                @endif
            </dd>

            @if($softwareLicense->issued && $softwareLicense->license_key)
                <dt class="col-sm-3">{{ __('store.software_license_key') }}</dt>
                <dd class="col-sm-9">
                    <code class="user-select-all">{{ $softwareLicense->license_key }}</code>
                </dd>
            @endif

            @if(! empty($softwareLicense->host_binding))
                <dt class="col-sm-3">{{ __('store.software_host_binding') }}</dt>
                <dd class="col-sm-9">
                    @foreach($softwareLicense->host_binding as $k => $v)
                        <span class="badge bg-secondary me-1"><code>{{ $k }}</code> = {{ $v }}</span>
                    @endforeach
                </dd>
            @endif

            @if($softwareLicense->issued_at)
                <dt class="col-sm-3">{{ __('store.software_issued_at') }}</dt>
                <dd class="col-sm-9">{{ $softwareLicense->issued_at->format('Y-m-d H:i') }}</dd>
            @endif

            @if($softwareLicense->expires_at)
                <dt class="col-sm-3">{{ __('store.software_expires_at') }}</dt>
                <dd class="col-sm-9">{{ $softwareLicense->expires_at->format('Y-m-d') }}</dd>
            @endif
        </dl>

        @if(! $softwareLicense->issued && ! $softwareLicense->isRevoked())
            <a href="{{ route('store.auth.services.software.activate.show', $service->id) }}" class="btn btn-primary">
                <i class="fas fa-play-circle me-1"></i>{{ __('store.software_activate') }}
            </a>
        @endif

        @if($softwareLicense->last_error)
            <div class="alert alert-danger mt-3 mb-0 small">
                <strong>{{ __('store.software_last_error') }}:</strong> {{ $softwareLicense->last_error }}
            </div>
        @endif
    </div>
</div>
