//
//  MFSizeThreshold.h
//  mobilefirst
//
//  Created by Scott Pfeil on 1/31/17.
//  Copyright © 2017 Verizon Wireless Inc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>

typedef NS_ENUM(NSInteger, MFSizeCompareDirection) {
    MFSizeGreaterThan = 0,
    MFSizeLessThan = 1
};

@interface MFSizeThreshold : NSObject

@property (nonatomic) CGFloat size;
@property (nonatomic) CGFloat threshold;
@property (nonatomic) MFSizeCompareDirection direction;
@property (nonatomic) BOOL scale;
@property (nonatomic, strong, nullable) NSNumber *scaleBaseValue;
@property (nonatomic, copy) void (^ _Nullable thresholdBlock)(void);

- (CGFloat)getValueForSizeScalingIfNeeded:(CGFloat)size;

#pragma mark - Size Initializers

// For getting a size based on threshold
- (nullable instancetype)initWithSize:(CGFloat)size forThreshold:(CGFloat)threshold compareDirection:(MFSizeCompareDirection)compareDirection;
- (nullable instancetype)initWithSize:(CGFloat)size forThreshold:(CGFloat)threshold compareDirection:(MFSizeCompareDirection)compareDirection scaleBasedOnScreenSize:(BOOL)scaleBasedOnScreenSize;

#pragma mark - Block Initializers

// For performing a block based on threshold
- (nullable instancetype)initWithThreshold:(CGFloat)threshold compareDirection:(MFSizeCompareDirection)compareDirection block:(nonnull void (^)(void))thresholdBlock;
- (nullable instancetype)initWithThreshold:(CGFloat)threshold compareDirection:(MFSizeCompareDirection)compareDirection scaleBasedOnScreenSize:(BOOL)scaleBasedOnScreenSize block:(nonnull void (^)(void))thresholdBlock;

#pragma mark - Common Size Getters

// Convenience functions to return common threshold pairings.
+ (nullable instancetype)largerThanCustomSize:(CGFloat)size forThreshold:(CGFloat)threshold;
+ (nullable instancetype)smallerThanCustomSize:(CGFloat)size forThreshold:(CGFloat)threshold;
+ (nullable instancetype)scalingLargerThanCustomSize:(CGFloat)size forThreshold:(CGFloat)threshold;
+ (nullable instancetype)scalingSmallerThanCustomSize:(CGFloat)size forThreshold:(CGFloat)threshold;

#pragma mark - Common Block Getters

// Convenience functions to return common threshold pairings.
+ (nullable instancetype)largerThanCustomThreshold:(CGFloat)threshold block:(nonnull void (^)(void))thresholdBlock;
+ (nullable instancetype)smallerThanCustomThreshold:(CGFloat)threshold block:(nonnull void (^)(void))thresholdBlock;
+ (nullable instancetype)scalingLargerThanCustomThreshold:(CGFloat)threshold block:(nonnull void (^)(void))thresholdBlock;
+ (nullable instancetype)scalingSmallerThanCustomThreshold:(CGFloat)threshold block:(nonnull void (^)(void))thresholdBlock;

@end
