import Localization

public extension DiscountAlertStyle {
    enum Preset: CaseIterable {
        case proMonthly
        case premierMonthly
        case proYearly
        case premierYearly
        case catchAll

        func textCopy(discountPercentage: Int) -> DiscountAlertStyle.TextCopy {
            // Generic discount alert that says "SALE" and "UP TO X% OFF" with an "Upgrade Now" CTA
            switch self {
            case .catchAll,
                 .proMonthly,
                 .premierMonthly,
                 .proYearly,
                 .premierYearly:
                return .init(
                    promotionName: L10n.FeatureBrandedAlert.discountName,
                    promotionHeadline: L10n.FeatureBrandedAlert.discountHeadline,
                    promotionHeadlineEmphasized: L10n.FeatureBrandedAlert.discountHeadlineEmphasized(discountPercentage),
                    promotionDescription: "",
                    buttonCopy: L10n.FeatureBrandedAlert.discountUpgradeButton
                )
            }
        }

        var tapAction: DiscountAlertStyle.TapAction {
            switch self {
            case .catchAll,
                 .proMonthly,
                 .premierMonthly,
                 .proYearly,
                 .premierYearly:
                return .openSubscriptionPage
            }
        }
    }
}
