#import <UIKit/UIKit.h>

#import "AdinCubeUserConsentAnswer.h"
#import "AdinCubeUserConsentPurpose.h"
#import "AdinCubeUserConsentExternal.h"
#import "AdinCubeUserConsentDelegates.h"

/*!
 @abstract Utility class to manage user consent.
 */
@interface AdinCubeUserConsent : NSObject

/*!
 @abstract Utility object to manage external consent.
 */
- (AdinCubeUserConsentExternal*)External;

/*!
 @abstract User consent event delegate for ask method.
 */
@property (weak, nullable) id<AdinCubeUserConsentAskDelegate> askDelegate;

/*!
 @abstract User consent event delegate for edit method.
 */
@property (weak, nullable) id<AdinCubeUserConsentEditDelegate> editDelegate;

/*!
 @abstract YES if GDPR applies to the current user.
 */
@property (readonly) BOOL gdprApplies;

/*!
 @abstract Ask its consent to the user and pass it to all networks.
 @discussion It will only display the consent screen, if it is applicable and has not been given yet.
 @param rootViewController View controller currently on screen.
 */
- (void)ask:(nonnull UIViewController*)rootViewController;

/*!
 @abstract Allow the user to change the consent he has provided previously.
 @param rootViewController View controller currently on screen.
 */
- (void)edit:(nonnull UIViewController*)rootViewController;

/*!
 @abstract Return a representation of the consent of the user in the form of an IAB consent string.
 */
- (NSString*)getIABConsentString;

/*!
 @abstract Return true if the user has given its consent for its data to be collected/transmitted to the given vendor.
 @param vendorSlug The identifier of the vendor. The full list of identifier is available at https://consent-form.ogury.co/unifiedVendors/latest/unifiedVendors.json
 */
- (BOOL)isAccepted:(NSString*)vendorSlug;

/*!
 @abstract Return true if the user has given its consent for its data to be collected by vendors for the given purpose.
 @param purpose Purpose defining why vendors are collecting the data.
 */
- (BOOL)isPurposeAccepted:(AdinCubeUserConsentPurpose)purpose;

@end
