using System;
using System.Threading.Tasks;
namespace Unity.Services.Mediation
{
///
/// Interface of an Interstitial Ad.
///
public interface IInterstitialAd : IDisposable
{
///
/// Event to be triggered by the adapter when an Ad is loaded.
///
event EventHandler OnLoaded;
///
/// Event to be triggered by the adapter when an Ad fails to load.
///
event EventHandler OnFailedLoad;
///
/// Event to be triggered by the adapter when an Ad is started.
///
event EventHandler OnShowed;
///
/// Event to be triggered by the adapter when the user clicks on the Ad.
///
event EventHandler OnClicked;
///
/// Event to be triggered by the adapter when the Ad is closed.
///
event EventHandler OnClosed;
///
/// Event to be triggered by the adapter when the Ad has an error.
///
event EventHandler OnFailedShow;
///
/// Get the current state of the ad.
///
AdState AdState { get; }
///
/// Get the ad unit id set during construction.
///
string AdUnitId { get; }
///
/// Method to tell the Mediation SDK to load an Ad.
///
/// LoadAsync Task
/// Thrown when the ad failed to load
Task LoadAsync();
///
/// Method to tell the Mediation SDK to show the loaded Ad.
///
/// Optional, allows setting optional parameters for showing an interstitial ad.
/// ShowAsync Task
/// Thrown when the ad failed to show
Task ShowAsync(InterstitialAdShowOptions showOptions = null);
}
///
/// Contains optional parameters for showing an interstitial ad.
///
public class InterstitialAdShowOptions
{
///
/// If set to true, the ad will automatically load another ad after it is done showing, so it is not necessary
/// to call LoadAsync again. This will occur when the OnClosed or OnFailedShow event is triggered.
///
public bool AutoReload { get; set; } = false;
}
}