import ComponentLibrary
import SwiftUI

struct GenerationCompleteView: View {
    var toast: ToastReducer.State.ToastType
    var tapAction: (() -> Void)?

    var body: some View {
        VStack(alignment: .leading, spacing: 0) {
            Group {
                switch toast.message {
                case .string(let string):
                    Text(string)
                case .attributedString(let attributedString):
                    Text(attributedString)
                }
            }
            .foregroundStyle(Color.SemanticV1.textPrimary)
            .typographyV1(.body2)
        }
        .frame(maxWidth: .infinity)
        .multilineTextAlignment(.leading)
        .lineLimit(3)
        .padding(.vertical, 20)
        .padding(.horizontal, 16)
        .background {
            Image.Assets.defaultOrange
                .resizable()
                .scaledToFill()
                .blur(radius: 3.0)
        }
        .clipShape(.rect(cornerRadius: 8))
        .environment(\.colorScheme, .dark)
        .onTapGesture {
            tapAction?()
        }
    }
}
