import SwiftUI

struct PostDetailView: View {
    let post: Post

    var body: some View {
        VStack(alignment: .leading, spacing: 0) {
            // Шапка поста
            HStack {
                Image(systemName: "person.crop.circle.fill")
                    .resizable()
                    .frame(width: 36, height: 36)
                    .foregroundColor(.gray)
                Text(post.authorUsername)
                    .font(.headline)
                Spacer()
                Button(action: {}) {
                    Image(systemName: "ellipsis")
                        .foregroundColor(.primary)
                }
            }
            .padding(.horizontal)
            .padding(.vertical, 8)

            // Изображение поста
            Rectangle()
                .fill(Color.gray.opacity(0.3))
                .aspectRatio(1, contentMode: .fit)
                .frame(maxWidth: .infinity)

            // Панель действий
            HStack(spacing: 16) {
                Button(action: {}) {
                    Image(systemName: "heart")
                        .font(.system(size: 24))
                }
                Button(action: {}) {
                    Image(systemName: "message")
                        .font(.system(size: 24))
                }
                Button(action: {}) {
                    Image(systemName: "paperplane")
                        .font(.system(size: 24))
                }
                Spacer()
                Button(action: {}) {
                    Image(systemName: "square.and.arrow.down")
                        .font(.system(size: 24))
                }
                Button(action: {}) {
                    Image(systemName: "bookmark")
                        .font(.system(size: 24))
                }
            }
            .foregroundColor(.primary)
            .padding(.horizontal)
            .padding(.top, 8)

            // Лайки и описание
            VStack(alignment: .leading, spacing: 4) {
                Text("\(post.likes) likes")
                    .font(.headline)

                Text(post.description ?? "")
                    .font(.subheadline)
            }
            .padding(.horizontal)
            .padding(.top, 8)

            // Комментарии
            VStack(alignment: .leading, spacing: 4) {
                Text("View all \(post.commentsCount) comments")
                    .font(.caption)
                    .foregroundColor(.secondary)
                    .padding(.top, 4)
                
                Text("2 hours ago")
                    .font(.caption2)
                    .foregroundColor(.secondary)
                    .padding(.top, 4)
            }
            .padding(.horizontal)
        }
    }
}
