import SwiftUI

struct SettingsSheet: View {
    @Bindable var model: ProjectModel
    @Environment(\.dismiss) private var dismiss

    var body: some View {
        NavigationStack {
            Form {
                Section("Playback") {
                    Toggle("Count-in", isOn: $model.countIn)
                    Toggle("Metronome", isOn: $model.metronome)
                }
                Section {
                    Toggle("Hear my part while recording", isOn: $model.monitorOwnPart)
                } header: {
                    Text("Recording")
                } footer: {
                    Text("Recording always includes a one-measure count-in. Wear headphones so the other parts don't bleed into your mic.")
                }
                Section {
                    LabeledContent("Sync calibration") {
                        Text("automatic")
                            .foregroundStyle(.secondary)
                    }
                } footer: {
                    Text("Timing is aligned automatically from hardware timestamps. If a take consistently lands early or late, use its per-take nudge in the part sheet. A guided measurement routine is coming with export.")
                }
            }
            .navigationTitle("Settings")
            .navigationBarTitleDisplayMode(.inline)
            .toolbar {
                ToolbarItem(placement: .topBarTrailing) {
                    Button("Done") { dismiss() }
                }
            }
        }
    }
}
