import SwiftUI

struct ExcludeStylesInput: View {
    let text: String
    let iconName: String
    let onTap: (() -> Void)?
    
    init(
        text: String = "Exclude styles",
        iconName: String = "Icon/music-note-slash",
        onTap: (() -> Void)? = nil
    ) {
        self.text = text
        self.iconName = iconName
        self.onTap = onTap
    }
    
    var body: some View {
        Button(action: {
            onTap?()
        }) {
            HStack(spacing: 8) {
                Image(iconName)
                    .resizable()
                    .renderingMode(.template)
                    .aspectRatio(contentMode: .fit)
                    .foregroundColor(Constants.Colors.Foreground.primary)
                    .frame(width: 16, height: 16)
                
                Text(text)
                    .font(Constants.Typography.xSmallTitle)
                    .foregroundColor(Constants.Colors.Foreground.inactive)
                    .tracking(0.24)
                
                Spacer()
            }
            .frame(height: 56)
            .padding(.horizontal, 16)
            .background(
                RoundedRectangle(cornerRadius: 12)
                    .fill(Constants.Colors.Background.Smoke.dense)
            )
        }
        .buttonStyle(PlainButtonStyle())
    }
}

// MARK: - Preview
#Preview {
    VStack(spacing: 16) {
        ExcludeStylesInput()
        
        ExcludeStylesInput(
            text: "Custom text",
            iconName: "Icon/music-note-slash"
        ) {
            print("Custom input tapped")
        }
        
        ExcludeStylesInput(
            text: "Another option",
            iconName: "Icon/clear"
        )
    }
    .padding()
    .background(Constants.Colors.Background.secondary)
}
