//
//  IndexView.swift
//  vibes
//
//  Created on 11/20/25.
//

import SwiftUI

struct Person: Identifiable {
    let id = UUID()
    let name: String
    let explorations: [Exploration]
}

struct Exploration: Identifiable {
    let id = UUID()
    let name: String
}

struct IndexView: View {
    let people: [Person] = [
        Person(name: "Yamill", explorations: [
            Exploration(name: "Orpheus")
        ]),
        Person(name: "Nick", explorations: [
            Exploration(name: "Add to Library")
        ])
    ]

    var body: some View {
        NavigationStack {
            List {
                ForEach(people) { person in
                    Section(header: Text(person.name)) {
                        ForEach(person.explorations) { exploration in
                            NavigationLink {
                                if exploration.name == "Add to Library" {
                                    VersionsBRootView()
                                        .navigationBarBackButtonHidden(true)
                                        .gesture(
                                            DragGesture()
                                                .onChanged { _ in }
                                        )
                                } else {
                                    ContentView()
                                        .navigationBarBackButtonHidden(true)
                                        .gesture(
                                            DragGesture()
                                                .onChanged { _ in }
                                        )
                                }
                            } label: {
                                Text(exploration.name)
                                    .font(Constants.Typography.mediumRegular)
                                    .foregroundColor(Constants.ForegroundPrimary)
                                    .padding(.vertical, 4)
                            }
                        }
                    }
                }
            }
            .listStyle(.insetGrouped)
            .scrollContentBackground(.hidden)
            .background(Constants.BackgroundPrimary)
            .navigationTitle("Swift Vibes")
            .navigationBarTitleDisplayMode(.large)
        }
    }
}

#Preview {
    IndexView()
}
