// Copyright 2019 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_FEATURES_SYSTEM_FLAGS_H_
#define IOS_CHROME_BROWSER_SHARED_PUBLIC_FEATURES_SYSTEM_FLAGS_H_

#import <Foundation/Foundation.h>

#import <optional>
#import <string>

#include "base/time/time.h"

enum class UpdateChromeSafetyCheckState;
enum class PasswordSafetyCheckState;
enum class SafeBrowsingSafetyCheckState;

// This file can be empty. Its purpose is to contain the flags living in the
// System Settings, used for testing/debugging. No base::Feature (or check for
// them) should be added.

namespace experimental_flags {

// Whether the First Run UI will always be displayed.
bool AlwaysDisplayFirstRun();

// Whether the First Run UI will never be displayed. Useful when running
// automated testing on the "chrome" build target which otherwise cannot skip
// the FRE using tests_hook::DisableDefaultFirstRun
bool NeverDisplayFirstRun();

// Returns the host name for an alternative Origin Server host for use by
// `BrandCode` startup ping. Returns empty string if there is no alternative
// host specified.
NSString* GetOriginServerHost();

// Returns the URL for the alternative Discover Feed server.
NSString* GetAlternateDiscoverFeedServerURL();

// Returns true if the prefs for the notice card views count and clicks count
// should be reset to zero on feed start.
// TODO(crbug.com/40173621): Remove after launch.
bool ShouldResetNoticeCardOnFeedStart();

// Returns true if the top of feed signin promo should be shown regardless of
// dismissal conditions. The promo will still only show for signed out users.
bool ShouldForceFeedSigninPromo();

// Returns true if device locale conditions should be ignored when gating a
// feature.
bool ShouldIgnoreDeviceLocaleConditions();

// Returns true if the top of feed notifications promo should be shown
// regardless of dismissal conditions. It is only shown for signed in users.
bool ShouldForceContentNotificationsPromo();

// Returns true if Tile Ablation should be forced regardless of the value of
// `isTileAblationExperimentComplete`.
bool ShouldIgnoreTileAblationConditions();

// Whether memory debugging tools are enabled.
bool IsMemoryDebuggingEnabled();

// Whether omnibox debugging tools are enabled.
bool IsOmniboxDebuggingEnabled();

// Whether Spotlight debugging tools are enabled.
bool IsSpotlightDebuggingEnabled();

// Whether startup crash is enabled.
bool IsStartupCrashEnabled();

// Whether the 3rd party keyboard omnibox workaround is enabled.
bool IsThirdPartyKeyboardWorkaroundEnabled();

// Whether the application group sandbox must be cleared before starting.
// Calling this method will reset the flag to false, so the sandbox is cleared
// only once.
bool MustClearApplicationGroupSandbox();

// Returns the name of the promo to be forced to display when the app is
// launched or resumed. Returns empty string if no promo is to be forced
// to display. Always returns nil for users in stable/beta.
NSString* GetForcedPromoToDisplay();

// Returns the forced state of the Update Chrome check in the Safety Check
// (Magic Stack) module.
std::optional<UpdateChromeSafetyCheckState> GetUpdateChromeSafetyCheckState();

// Returns the forced state of the Password check in the Safety Check (Magic
// Stack) module.
std::optional<PasswordSafetyCheckState> GetPasswordSafetyCheckState();

// Returns the forced state of the Safe Browsing check in the Safety Check
// (Magic Stack) module.
std::optional<SafeBrowsingSafetyCheckState> GetSafeBrowsingSafetyCheckState();

// Returns the forced number of weak passwords for the Safety Check (Magic
// Stack) module.
std::optional<int> GetSafetyCheckWeakPasswordsCount();

// Returns the forced number of reused passwords for the Safety Check (Magic
// Stack) module.
std::optional<int> GetSafetyCheckReusedPasswordsCount();

// Returns the forced number of compromised passwords for the Safety Check
// (Magic Stack) module.
std::optional<int> GetSafetyCheckCompromisedPasswordsCount();

// Returns the background duration needed before opening the Home Surface upon
// app open.
base::TimeDelta GetReturnToHomeSurfaceDuration();

// Returns the forced number of days since first run.
std::optional<int> GetFirstRunRecency();

// Returns the selected device segment the user wants to simulate as a string;
// the string should either be nil or one of the options from synthetic trial
// "Segmentation_DeviceSwitcher."
// The value could be set both from Experimental Settings and command line
// switches, but the former takes precedence.
std::string GetSegmentForForcedDeviceSwitcherExperience();

// Returns the selected shopper segment the user wants to simulate as a string.
// The string should either be nil, "ShoppingUser", or "Other". The value could
// be set both from Experimental Settings and command line switches, but the
// former takes precedence.
std::string GetSegmentForForcedShopperExperience();

// Whether a phone backup/restore state should be simulated due to experimental
// settings. Uses `tests_hook::SimulatePostDeviceRestore()` to check whether
// this feature should be enabled for EG tests.
bool SimulatePostDeviceRestore();

// In production, the history sync opt-in isn't shown if it was declined too
// recently or too many consecutive times. If this function is true, those
// limits are suppressed for simpler testing.
bool ShouldIgnoreHistorySyncDeclineLimits();

// Returns the inactivity threshold to be used for displaying Safety Check
// notifications, overriding the default value stored in the code or any value
// set by Finch.
//
// Returns `std::nullopt` if no override is specified.
std::optional<int> GetForcedInactivityThresholdForSafetyCheckNotifications();

// Returns the forced state of the Tips (Magic Stack) module.
std::optional<int> GetForcedTipsMagicStackState();

// Whether the Lens Shop state for Tips (Magic Stack) should display a product
// image.
bool ShouldDisplayLensShopTipWithImage();

// Whether Inactive Tabs should be in Demo mode, where tabs are
// considered inactive after a minute.
bool ShouldUseInactiveTabsDemoThreshold();

// Whether Inactive Tabs should be in Automated Testing mode, where
// tabs are immediately considered inactive.
bool ShouldUseInactiveTabsTestThreshold();

// Whether the first party incognito experience should be simulated.
bool ShouldOpenInIncognitoOverride();

// Whether the a delay should be added to the asynchronous startup.
bool ShouldDelayAsyncStartup();

// Whether to always show the first party incognito experience UI.
bool AlwaysShowTheFirstPartyIncognitoUI();

// Enables the AI menu, which is a tool for debugging LLM queries.
bool EnableAIPrototypingMenu();

// Gets GWS URL base used to generate Lens result panel URLs. Returns nil if
// there is no alternative URL specified.
NSString* GetLensResultPanelGwsURL();

// Gets GWS URL base used to generate Cobrowse URLs. Returns nil if there is no
// alternative URL specified.
NSString* GetCobrowseGwsURL();

// Returns true if Composebox AIM eligibility should be disabled.
bool ShouldForceDisableComposeboxAIM();

// Returns true if Composebox Create Images eligibility should be disabled.
bool ShouldForceDisableComposeboxCreateImages();

// Returns true if Canvas eligibility should be disabled.
bool ShouldForceDisableComposeboxCanvas();

// Returns true if Deep Search eligibility should be disabled.
bool ShouldForceDisableComposeboxDeepSearch();

// Returns true if Composebox Pdf Upload eligibility should be disabled.
bool ShouldForceDisableComposeboxPdfUpload();

// Returns true if the Catalog items should be shown in Settings. Always true
// in debug builds.
bool ShouldShowCatalogItems();

// Returns true if multi-profile forced migration should be considered done.
bool ShouldForceMultiProfileForcedMigrationDone();

// Returns true if Backend Promo debug tools should be shown in Settings.
bool ShouldShowBackendPromoDebugTools();

// Returns the selected push notification type to be force triggered.
int GetForcedPushNotificationType();

// Returns the delay in seconds before triggering the forced push notification.
int GetForcedPushNotificationDelay();

}  // namespace experimental_flags

#endif  // IOS_CHROME_BROWSER_SHARED_PUBLIC_FEATURES_SYSTEM_FLAGS_H_
