//
//  DocumentPreviewView.swift
//  AlloVoisinsSwiftUI
//
//  Created by Victor on 16/12/2024.
//

import Lottie
import SwiftUI

struct DocumentPreviewView: View {
    let fileName: String
    let onDelete: () -> Void

    var body: some View {
        VStack {
            ZStack(alignment: .topTrailing) {
                VStack {
                    if true {
                        SQImage("visit_card_new", height: 160)
                    } else {
                        SQIcon(.file_pdf, size: .l, color: .sqNeutral(80))
                        SQText("PDF")
                            .sqFont(.semiBold)
                    }
                }
                .frame(width: 160, height: 160, alignment: .center)
                .overlay(
                    RoundedRectangle(cornerRadius: 8)
                        .inset(by: 0.5)
                        .stroke(Color.sqNeutral(20), lineWidth: 1)
                )

                Button {} label: {
                    SQIcon(.xmark, size: .s, color: .white)
                        .padding()
                        .background {
                            Circle()
                                .foregroundColor(Color.sqSemanticRed)
                                .frame(height: 32)
                        }
                        .padding(-16)
                }
            }

            SQText(fileName)
                .sqSize(13)
        }
    }
}

#Preview {
    DocumentPreviewView(fileName: "le-nom-de-mon-fichier.pdf") {}
}
