// Copyright 2017 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_PUBLIC_COMMANDS_SNACKBAR_COMMANDS_H_
#define IOS_CHROME_BROWSER_SHARED_PUBLIC_COMMANDS_SNACKBAR_COMMANDS_H_

#import <UIKit/UIKit.h>

@class SnackbarMessage;

// Commands related to Snackbar.
@protocol SnackbarCommands

// Shows a snackbar using a SnackbarMessage. On navigation controllers,
// use the bottom toolbar height as bottom offset. Otherwise, use the browser's
// bottom toolbar height as bottom offset.
- (void)showSnackbarMessage:(SnackbarMessage*)message;

// Shows a snackbar using a SnackbarMessage. Use the browser's bottom
// toolbar height as bottom offset. This is used when the presented view will be
// dismissed and web content will become visible.
- (void)showSnackbarMessageOverBrowserToolbar:(SnackbarMessage*)message;

// Shows a snackbar using a SnackbarMessage, with haptic feedback.
- (void)showSnackbarMessage:(SnackbarMessage*)message
             withHapticType:(UINotificationFeedbackType)type;

// Shows a snackbar using a SnackbarMessage, with a specific bottom
// offset.
- (void)showSnackbarMessage:(SnackbarMessage*)message
               bottomOffset:(CGFloat)offset;

// Shows a snackbar using a SnackbarMessage after dismissing the
// keyboard if present.
- (void)showSnackbarMessageAfterDismissingKeyboard:(SnackbarMessage*)message;

// Shows a snackbar displaying a message with `messageText` and a button with
// `buttonText` which triggers `messageAction` on tap. `completionAction` will
// be called when the snackbar finishes presenting, BOOL is YES if the dismissal
// was caused by a user action and NO if not. It will use the Bottom toolbar
// height as bottom offset. Use this method if displaying a Snackbar while the
// Web content is visible. If there's no bottom toolbar offset will be 0.
- (void)showSnackbarWithMessage:(NSString*)messageText
                     buttonText:(NSString*)buttonText
                  messageAction:(void (^)(void))messageAction
               completionAction:(void (^)(BOOL))completionAction;

// Shows a snackbar displaying a message with `messageText` and a button with
// `buttonText` and `buttonAccessibilityHint` which triggers `messageAction` on
// tap. `completionAction` will be called when the snackbar finishes presenting,
// BOOL is YES if the dismissal was caused by a user action and NO if not. It
// will use the Bottom toolbar height as bottom offset. Use this method if
// displaying a Snackbar while the Web content is visible. If there's no bottom
// toolbar offset will be 0.
- (void)showSnackbarWithMessage:(NSString*)messageText
                     buttonText:(NSString*)buttonText
        buttonAccessibilityHint:(NSString*)buttonAccesibilityHint
                  messageAction:(void (^)(void))messageAction
               completionAction:(void (^)(BOOL))completionAction;

// Dismisses the snackbar displaying `messageText`.
// TODO(crbug.com/509919378): Introduce snackbar ID and use that as a reference
// instead of the `messageText`.
- (void)dismissSnackbarWithMessage:(NSString*)messageText
                          animated:(BOOL)animated;

// Dismisses all presented snackbars.
- (void)dismissAllSnackbars;

@end

// Protocol for temporary Gemini Actor snackbar commands.
// TODO(crbug.com/512521102): Remove when the agent prototype is cleaned up.
@protocol GeminiActorSnackbarCommands <NSObject>

// Shows a snackbar displaying `message` above the Gemini floaty UI without
// hiding the floaty. `offset` is an additional bottom offset in points added
// to the default base offset (e.g. to prevent overlapping the floaty UI).
- (void)showGeminiActorSnackbarMessage:(SnackbarMessage*)message
                additionalBottomOffset:(CGFloat)offset;

@end

#endif  // IOS_CHROME_BROWSER_SHARED_PUBLIC_COMMANDS_SNACKBAR_COMMANDS_H_
