import SwiftUI

struct AircraftRow: View {
    let aircraft: Aircraft
    let theme: Theme
    let isSelected: Bool
    
    var body: some View {
        let colors = theme.colors
        HStack {
            Text(aircraft.callsign)
                .font(.system(size: 12, weight: .bold, design: .monospaced))
                .foregroundColor(isSelected ? colors.accent : colors.text)
            Spacer()
            Text(aircraft.type)
                .font(.system(size: 12))
                .foregroundColor(colors.textDim)
            Spacer()
            Text("\(Int(aircraft.altitudeFt))")
                .font(.system(size: 12))
                .foregroundColor(colors.textDim)
            Spacer()
            Text("\(Int(aircraft.groundSpeedKt))")
                .font(.system(size: 12))
                .foregroundColor(colors.textDim)
            Spacer()
            Text("\(Int(aircraft.bearingDeg))°")
                .font(.system(size: 12))
                .foregroundColor(colors.textDim)
        }
        .padding(.horizontal, 18)
        .padding(.vertical: 6)
        .background(isSelected ? colors.chip : Color.clear)
        .overlay(
            HStack {
                if isSelected {
                    Rectangle()
                        .fill(colors.accent)
                        .frame(width: 2, height: 24)
                }
                Spacer()
            }
        )
    }
}

struct MediumAircraftRow: View {
    let aircraft: Aircraft
    let theme: Theme
    let isSelected: Bool
    
    var body: some View {
        let colors = theme.colors
        HStack {
            Text(aircraft.callsign)
                .font(.system(size: 12, weight: .bold, design: .monospaced))
                .foregroundColor(isSelected ? colors.accent : colors.text)
            Spacer()
            Text("\(Int(aircraft.altitudeFt))")
                .font(.system(size: 12))
                .foregroundColor(colors.textDim)
            Text("\(Int(aircraft.groundSpeedKt))")
                .font(.system(size: 12))
                .foregroundColor(colors.textDim)
        }
        .padding(.horizontal, 14)
        .padding(.vertical: 5)
        .background(isSelected ? colors.chip : Color.clear)
        .overlay(
            HStack {
                if isSelected {
                    Rectangle()
                        .fill(colors.accent)
                        .frame(width: 2, height: 24)
                }
                Spacer()
            }
        )
    }
}
