//
// OpenRocky — Voice-first AI Agent
// https://github.com/openrocky
//
// Developed by everettjf with the assistance of Claude Code and Codex.
// Date: 2026-05-04
// Copyright (c) 2026 everettjf. All rights reserved.
//

import SwiftUI

/// Drill-in detail of the rolling 32-entry timeline buffer. The home card's
/// inline window keeps the surface uncluttered; this view is for users who
/// want the full breadcrumb of a delegate-task (planStarted → every tool
/// call → planCompleted) without anything getting trimmed.
struct OpenRockyTimelineFullView: View {
    let timeline: [TimelineEntry]

    var body: some View {
        ScrollView {
            VStack(alignment: .leading, spacing: 12) {
                ForEach(timeline) { entry in
                    HStack(alignment: .top, spacing: 12) {
                        ZStack {
                            RoundedRectangle(cornerRadius: 8, style: .continuous)
                                .fill(entry.kind.tint.opacity(0.14))
                                .frame(width: 30, height: 30)

                            Image(systemName: entry.kind.symbol)
                                .font(.system(size: 12, weight: .bold))
                                .foregroundStyle(entry.kind.tint)
                        }

                        VStack(alignment: .leading, spacing: 3) {
                            HStack {
                                Text(entry.kind.title)
                                    .font(.system(size: 12, weight: .bold, design: .rounded))
                                    .foregroundStyle(.white)

                                Spacer(minLength: 8)

                                Text(entry.time)
                                    .font(.system(size: 10, weight: .medium, design: .monospaced))
                                    .foregroundStyle(OpenRockyPalette.label)
                            }
                            Text(entry.text)
                                .font(.system(size: 12, weight: .medium, design: .rounded))
                                .foregroundStyle(OpenRockyPalette.muted)
                                .fixedSize(horizontal: false, vertical: true)
                        }
                    }
                }
            }
            .padding(16)
        }
        .background(OpenRockyPalette.background.ignoresSafeArea())
        .navigationTitle("Timeline")
        .navigationBarTitleDisplayMode(.inline)
    }
}
