import SwiftUI

struct EmptyStateView: View {
    let systemImage: String
    let title: String
    let message: String
    var actionTitle: String? = nil
    var action: (() -> Void)? = nil

    var body: some View {
        ContentUnavailableView(
            label: {
                Label(title, systemImage: systemImage)
            },
            description: {
                Text(message)
            },
            actions: {
                if let actionTitle, let action {
                    Button(actionTitle, action: action)
                        .buttonStyle(.borderedProminent)
                }
            }
        )
    }
}

#Preview {
    EmptyStateView(
        systemImage: "books.vertical",
        title: "No Shelves",
        message: "Your library is empty. Create a shelf in BookStack to get started.",
        actionTitle: "Refresh",
        action: {}
    )
}
