@extends('layouts.admin')

@section('content')
<div class="container-fluid">
    <div class="row">
        <div class="col-12">
            <div class="page-title-box">
                <div class="page-title-right">
                    <a href="{{ route('admin.system-backups.index') }}" class="btn btn-secondary">
                        <i class="fas fa-arrow-left"></i> Back to Backups
                    </a>
                </div>
                <h4 class="page-title">Backup Detail</h4>
            </div>
        </div>
    </div>

    @if(session('success'))
        <div class="alert alert-success alert-dismissible fade show" role="alert">
            {{ session('success') }}
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
        </div>
    @endif

    <div class="row">
        <div class="col-lg-8">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title">Backup Information</h4>
                </div>
                <div class="card-body">
                    <div class="mb-3">
                        <label class="form-label fw-bold">Name</label>
                        <p>{{ $systemBackup->name }}</p>
                    </div>

                    <div class="mb-3">
                        <label class="form-label fw-bold">File Path</label>
                        <p>{{ $systemBackup->file_path ?: '—' }}</p>
                    </div>

                    <div class="mb-3">
                        <label class="form-label fw-bold">Size</label>
                        <p>{{ $systemBackup->size }}</p>
                    </div>

                    <div class="mb-3">
                        <label class="form-label fw-bold">Type</label>
                        <p>
                            <span class="badge bg-{{ $systemBackup->type == 'full' ? 'primary' : ($systemBackup->type == 'database' ? 'info' : 'secondary') }} fs-6">
                                {{ ucfirst($systemBackup->type) }}
                            </span>
                        </p>
                    </div>

                    <div class="mb-3">
                        <label class="form-label fw-bold">Automatic</label>
                        <p>
                            <span class="badge bg-{{ $systemBackup->is_automatic ? 'success' : 'secondary' }}">
                                {{ $systemBackup->is_automatic ? 'Yes' : 'No' }}
                            </span>
                        </p>
                    </div>

                    <div class="mb-3">
                        <label class="form-label fw-bold">Completed At</label>
                        <p>{{ $systemBackup->completed_at ? \Carbon\Carbon::parse($systemBackup->completed_at)->format('F d, Y h:i A') : '—' }}</p>
                    </div>

                    <div class="mb-3">
                        <label class="form-label fw-bold">Created At</label>
                        <p>{{ $systemBackup->created_at->format('F d, Y h:i A') }}</p>
                    </div>

                    <div class="mb-3">
                        <label class="form-label fw-bold">Updated At</label>
                        <p>{{ $systemBackup->updated_at->format('F d, Y h:i A') }}</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
