//
//  ResiliationCheckStepView.swift
//  AlloVoisinsSwiftUI
//
//  Created by Victor on 14/10/2024.
//

import SwiftUI

struct ResiliationCheckStepView: View {
    var checkStep: ResiliationCheckStep
    @Binding var isSelected: Bool

    var body: some View {
        VStack(alignment: .leading) {
            if isSelected {
                Image("checked_neutral")
                    .frame(width: 20, height: 20)
            } else {
                Image("checkbox_unchecked")
                    .frame(width: 20, height: 20)
            }
            HStack(alignment: .center) {
                Spacer()
                Image(checkStep.image)
                    .resizable()
                    .scaledToFit()
                    .frame(height: 100)
                Spacer()
            }
            HStack {
                SQText(checkStep.text)
                    .multilineTextAlignment(.leading)
                Spacer()
            }
            .frame(maxWidth: .infinity)
        }
        .padding()
        .frame(maxWidth: .infinity)
        .overlay(
            RoundedRectangle(cornerRadius: 8)
                .stroke(Color.sqNeutral(30), lineWidth: 1)
        )
        .onTapGesture {
            self.isSelected.toggle()
        }
    }
}

#Preview {
    ResiliationCheckStepView(checkStep: .marketing, isSelected: .constant(true))
        .padding()
}
