// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef IOS_CHROME_BROWSER_SHARED_UI_ANIMATED_PROMO_ANIMATED_PROMO_VIEW_CONTROLLER_H_
#define IOS_CHROME_BROWSER_SHARED_UI_ANIMATED_PROMO_ANIMATED_PROMO_VIEW_CONTROLLER_H_

#import <UIKit/UIKit.h>

#import "ios/chrome/common/ui/confirmation_alert/confirmation_alert_action_handler.h"

@protocol LottieAnimation;

// Container view controller for a full-screen promo with a Lottie animation. If
// the height of the current size class is "regular", the top part of the view
// plays the animation, and the bottom part displays a
// `ConfirmationAlertViewController`.
@interface AnimatedPromoViewController : UIViewController

// The action handler for interactions in this view controller.
@property(nonatomic, weak) id<ConfirmationAlertActionHandler> actionHandler;

// The headline below the image. Must be set before the view is loaded.
@property(nonatomic, copy) NSString* titleString;

// The subtitle below the title. Must be set before the view is loaded.
@property(nonatomic, copy) NSString* subtitleString;

// The view displayed under titles and subtitles. Nil if not needed.
// If needed, must be set before the view is loaded.
@property(nonatomic, strong) UIView* underTitleView;

// The text for the primary action. Must be set before the view is loaded.
@property(nonatomic, copy) NSString* primaryActionString;

// The text for the secondary action. Must be set before the view is loaded.
@property(nonatomic, copy) NSString* secondaryActionString;

// The text for the tertiary action. Must be set before the view is loaded.
@property(nonatomic, copy) NSString* tertiaryActionString;

// The name of the animation resource to be used in light mode. Must be set
// before the view is loaded.
@property(nonatomic, copy) NSString* animationName;

// The name of the animation resource to be used in dark mode. Must be set
// before the view is loaded.
@property(nonatomic, copy) NSString* animationNameDarkMode;

// (Optional) The background color of the containing animation view. If set,
// must be set before the view is loaded.
@property(nonatomic, copy) UIColor* animationBackgroundColor;

// A dictionary that allows localization of text within the animations.
@property(nonatomic, copy)
    NSDictionary<NSString*, NSString*>* animationTextProvider;

// A dictionary that associate a keypath with a color, for the light/dark mode.
// `useLegacyDarkMode` should be NO for this to be taken into account.
@property(nonatomic, copy)
    NSDictionary<NSString*, UIColor*>* lightModeColorProvider;
@property(nonatomic, copy)
    NSDictionary<NSString*, UIColor*>* darkModeColorProvider;

// A boolean to indicate if the view controller should use the legacy mode for
// dark mode (i.e. finding a json ending with _darkmode). Default is YES.
@property(nonatomic, assign) BOOL useLegacyDarkMode;

// Custom animation view used in the full-screen promo.
@property(nonatomic, strong) id<LottieAnimation> animationViewWrapper;

// Custom animation view used in the full-screen promo in dark mode (legacy
// mode only). Only available after the view is loaded.
@property(nonatomic, strong, readonly) id<LottieAnimation>
    animationViewWrapperDarkMode;

// The offset from center Y to place the divider between the animation and the
// confirmation alert screen. Subclasses can override this to customize the
// split position. Default returns -24pt on devices with a tab strip, 0
// otherwise.
- (CGFloat)centerYOffset;

- (instancetype)init NS_DESIGNATED_INITIALIZER;

- (instancetype)initWithCoder:(NSCoder*)coder NS_UNAVAILABLE;
- (instancetype)initWithNibName:(NSString*)nibNameOrNil
                         bundle:(NSBundle*)nibBundleOrNil NS_UNAVAILABLE;

@end

#endif  // IOS_CHROME_BROWSER_SHARED_UI_ANIMATED_PROMO_ANIMATED_PROMO_VIEW_CONTROLLER_H_
