import SwiftUI

struct ContinueWatchingRow: View {
    let entries: [WatchHistoryEntry]
    let onSelect: (WatchHistoryEntry) -> Void
    @FocusState private var focusedEntry: String?

    var body: some View {
        VStack(alignment: .leading, spacing: 20) {
            Text("Continue Watching")
                .font(.title2)
                .fontWeight(.bold)
                .foregroundColor(.white)
                .padding(.horizontal, 80)

            ScrollView(.horizontal, showsIndicators: false) {
                HStack(spacing: 10) {
                    ForEach(entries) { entry in
                        Button {
                            onSelect(entry)
                        } label: {
                            ContinueWatchingCard(
                                entry: entry,
                                isFocused: focusedEntry == entry.id
                            )
                        }
                        .buttonStyle(.plain)
                        .focused($focusedEntry, equals: entry.id)
                    }
                }
                .padding(.horizontal, 80)
            }
        }
    }
}
