import ComponentLibrary
import Localization
import SwiftUI

// TODO: Revist fetching from statsig for the notif and using localizted copy instead
public struct NotificationsBannerView: View {
    let config: NotificationsBannerConfig
    let onDismiss: () -> Void

    public init(
        config: NotificationsBannerConfig,
        onDismiss: @escaping () -> Void
    ) {
        self.config = config
        self.onDismiss = onDismiss
    }

    public var body: some View {
        VStack(alignment: .leading, spacing: 8) {
            HStack(spacing: .zero) {
                Text(L10n.FeatureNotifications.bannerVideoCoverHooksTag)
                    .typographyV1(.body1)
                    .foregroundStyle(Color.SemanticV1.alwaysLighterBeige)
                    .multilineTextAlignment(.leading)
                    .padding(.horizontal, 8)
                    .padding(.vertical, 4)
                    .background(Color.SemanticV1.auraPink)
                    .cornerRadius(10)

                Spacer()

                Button {
                    onDismiss()
                } label: {
                    Image.Icon.close
                        .typographyV1(.body1)
                        .foregroundStyle(Color.SemanticV1.iconPrimary)
                }
                .buttonStyle(.plain)
            }

            VStack(alignment: .leading, spacing: 8) {
                Text(L10n.FeatureNotifications.bannerVideoCoverHooksTitle)
                    .typographyV1(.body1)
                    .foregroundStyle(Color.SemanticV1.textPrimary)
                    .multilineTextAlignment(.leading)

                Text(L10n.FeatureNotifications.bannerVideoCoverHooksSubtitle)
                    .typographyV1(.body2thin)
                    .foregroundStyle(Color.SemanticV1.textSecondary)
                    .multilineTextAlignment(.leading)
            }
            .padding(.trailing, 20)
        }
        .padding(.leading, 14)
        .padding(.trailing, 20)
        .padding(.vertical, 16)
        .background(
            RoundedRectangle(cornerRadius: 10)
                .fill(Color.SemanticV1.backgroundTertiary)
        )
        .frame(maxWidth: .infinity)
        .onTapGesture {
            // Do nothing - this prevents the List from handling the tap
        }
    }
}
