//
//  MVMCoreUIStackableViewController.h
//  MVMCoreUI
//
//  Created by Scott Pfeil on 2/1/19.
//  Copyright © 2019 Verizon Wireless. All rights reserved.
//

#import <MVMCoreUI/ProgrammaticScrollViewController.h>

@interface MVMCoreUIStackableViewController : ProgrammaticScrollViewController

// An array of ui elements that will be spaced out on the screen top to bottom from index 0 to formUIArray.count.
@property (nullable, strong, nonatomic) NSArray *formUIArray;

// Generates the form view with the passed in form ui array.
- (void)generateFormViewWithUIArray:(nullable NSArray <UIView *>*)formUIArray;
- (void)generateFormView:(nullable UIView *)view withUIArrayForConstrainingViews:(nullable NSArray <UIView *>*)formUIArray;

// Returns the spacing that should surround the passed in item. Subclass this to change spacing.
- (UIEdgeInsets)spaceAroundUIObject:(nullable id)object size:(CGFloat)size;

// Removes all the subviews in the form ui array.
- (void)removeUIViews;

// Removes all the subviews in the passed in array.
+ (void)removeUIViews:(nullable NSArray <UIView *>*)views;

// Returns the standard space around ui objects.
+ (UIEdgeInsets)standardSpaceAroundUIObjectForSize:(CGFloat)size;

// Consolidates generateFormViewWithUIArray and spaceArroundUIObject into one class object so other view controllers can take advantage of these functions. By default does not pin to margins.
+ (void)populateView:(nonnull UIView *)view withUIArray:(nonnull NSArray <UIView *>*)formUIArray withSpacingBlock:(nonnull UIEdgeInsets (^) (id _Nullable object))spacingBlock;
+ (void)populateView:(nonnull UIView *)view withUIArray:(nonnull NSArray <UIView *>*)formUIArray useMargins:(BOOL)useMargins withSpacingBlock:(nonnull UIEdgeInsets (^) (id _Nullable object))spacingBlock;
+ (void)populateViewHorizontally:(nonnull UIView *)view withUIArray:(nonnull NSArray <UIView *>*)formUIArray withSpacingBlock:(nonnull UIEdgeInsets (^) (id _Nullable object))spacingBlock;
+ (void)populateView:(nonnull UIView *)view withUIArrayForConstrainingViews:(nonnull NSArray <UIView *>*)formUIArray withSpacingBlock:(nonnull UIEdgeInsets (^) (id _Nullable object))spacingBlock;

// Does the actual laying out. The formuiarray views should already be added to the view. By default does not pin to margins
+ (void)autoLayoutView:(nonnull UIView *)view withUIArray:(nonnull NSArray <UIView *>*)formUIArray withSpacingBlock:(nonnull UIEdgeInsets (^) (id _Nullable object))spacingBlock;
+ (void)autoLayoutView:(nonnull UIView *)view withUIArray:(nonnull NSArray <UIView *>*)formUIArray useMargins:(BOOL)useMargins withSpacingBlock:(nonnull UIEdgeInsets (^) (id _Nullable object))spacingBlock;
+ (void)autoLayoutViewHorizontally:(nonnull UIView *)view withUIArray:(nonnull NSArray <UIView *>*)formUIArray withSpacingBlock:(nonnull UIEdgeInsets (^) (id _Nullable object))spacingBlock;
+ (void)autoLayoutViewWithConstrainingViewsWithUIArray:(nonnull NSArray <UIView *>*)formUIArray withSpacingBlock:(nonnull UIEdgeInsets (^) (id _Nullable object))spacingBlock;

@end
