// Copyright 2004-present Facebook. All Rights Reserved.
//
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
// copy, modify, and distribute this software in source code or binary form for use
// in connection with the web services and APIs provided by Facebook.
//
// As with any software that integrates with the Facebook platform, your use of
// this software is subject to the Facebook Developer Principles and Policies
// [http://developers.facebook.com/policy/]. This copyright notice shall be
// included in all copies or substantial portions of the software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#import <Foundation/Foundation.h>

#import <FBAudienceNetwork/FBAdDefines.h>

NS_ASSUME_NONNULL_BEGIN

/**
 Audience Network error domain (returned in NSErrors generated by the SDK)
 */
FB_EXPORT NSString * const FBAudienceNetworkErrorDomain;

/**
 Audience Network SDK logging levels
 */
typedef NS_ENUM(NSInteger, FBAdLogLevel) {
    /// No logging
    FBAdLogLevelNone,
    /// Notifications
    FBAdLogLevelNotification,
    /// Errors only
    FBAdLogLevelError,
    /// Warnings only
    FBAdLogLevelWarning,
    /// Standard log level
    FBAdLogLevelLog,
    /// Debug logging
    FBAdLogLevelDebug,
    /// Log everything (verbose)
    FBAdLogLevelVerbose
};

/**
 Determines what method is used for rendering FBMediaView content
 */
typedef NS_ENUM(NSInteger, FBMediaViewRenderingMethod) {
    /// Automatic selection of rendering method
    FBMediaViewRenderingMethodDefault,
    /// Force Metal rendering (only use for devices with support)
    FBMediaViewRenderingMethodMetal,
    /// Force OpenGL rendering
    FBMediaViewRenderingMethodOpenGL,
    /// Software fallback
    FBMediaViewRenderingMethodSoftware
};

/**
 Test Ad type to be injected when test mode is on
 */
typedef NS_ENUM(NSInteger, FBAdTestAdType) {
    // No specific ad type to be set.
    // This will return a random ad type when test mode is on.
    FBAdTestAdType_Default,
    // 16x9 image ad with app install CTA option
    FBAdTestAdType_Img_16_9_App_Install,
    // 16x9 image ad with link CTA option
    FBAdTestAdType_Img_16_9_Link,
    // nHD video 46 sec ad with app install CTA option
    FBAdTestAdType_Vid_nHD_46s_App_Install,
    // nHD video 46 sec ad with link CTA option
    FBAdTestAdType_Vid_nHD_46s_Link,
    // carousel ad with square image and app install CTA option
    FBAdTestAdType_Carousel_Img_Square_App_Install,
    // carousel ad with square image and link CTA option
    FBAdTestAdType_Carousel_Img_Square_Link
};

/**
  AdSettings contains global settings for all ad controls.
 */
FB_CLASS_EXPORT FB_SUBCLASSING_RESTRICTED
@interface FBAdSettings : NSObject

// When test mode is on, setting a non default value for testAdType will
// request the specified type of ad.
@property (class, nonatomic, assign) FBAdTestAdType testAdType;

/**
  Returns test mode on/off.
 */
+ (BOOL)isTestMode;

/**
  Returns the hashid of the device to use test mode on.
 */
+ (NSString *)testDeviceHash;

/**
  Adds a test device.

 - Parameter deviceHash: The id of the device to use test mode, can be obtained from debug log or testDeviceHash



 Copy the current device Id from debug log and add it as a test device to get test ads. Apps
 running on emulator will automatically get test ads. Test devices should be added before loadAd is called.
 */
+ (void)addTestDevice:(NSString *)deviceHash;

/**
  Add a collection of test devices. See `+addTestDevices:` for details.

 - Parameter devicesHash: The array of the device id to use test mode, can be obtained from debug log or testDeviceHash
 */
+ (void)addTestDevices:(FB_NSArrayOf(NSString *)*)devicesHash;

/**
  Clear all the added test devices
 */
+ (void)clearTestDevices;

/**
  Clears the added test device

 - Parameter deviceHash: The id of the device using test mode, can be obtained from debug log or testDeviceHash
 */
+ (void)clearTestDevice:(NSString *)deviceHash;

/**
  Configures the ad control for treatment as child-directed.

 - Parameter isChildDirected: Indicates whether you would like your ad control to be treated as child-directed

 Note that you may have other legal obligations under the Children's Online Privacy Protection Act (COPPA).
 Please review the FTC's guidance and consult with your own legal counsel.
 */
+ (void)setIsChildDirected:(BOOL)isChildDirected;

/**
  If an ad provided service is mediating Audience Network in their sdk, it is required to set the name of the mediation service

 - Parameter service: Representing the name of the mediation that is mediation Audience Network
 */
+ (void)setMediationService:(NSString *)service;

/**
  Gets the url prefix to use when making ad requests.

 This method should never be used in production.
 */
+ (nullable NSString *)urlPrefix;

/**
  Sets the url prefix to use when making ad requests.



 This method should never be used in production.
 */
+ (void)setUrlPrefix:(nullable NSString *) urlPrefix;

/**
  Gets the current SDK logging level
 */
+ (FBAdLogLevel)getLogLevel;

/**
  Sets the current SDK logging level
 */
+ (void)setLogLevel:(FBAdLogLevel)level;

/**
  Gets the FBMediaView rendering method
 */
+ (FBMediaViewRenderingMethod)mediaViewRenderingMethod;

/**
  Sets the FBMediaView rendering method
  - Parameter mediaViewRenderingMethod:
    FBMediaViewRenderingMethodDefault: SDK chooses optimized rendering method
    FBMediaViewRenderingMethodMetal: use Metal kit rendering method
    FBMediaViewRenderingMethodOpenGL: use OpenGL rendering method
    FBMediaViewRenderingMethodSoftware: use software rendering method
 */
+ (void)setMediaViewRenderingMethod:(FBMediaViewRenderingMethod)mediaViewRenderingMethod;

@end

NS_ASSUME_NONNULL_END
