//
//  MFStyler.m
//  myverizon
//
//  Created by Scott Pfeil on 11/26/14.
//  Copyright (c) 2014 Verizon Wireless. All rights reserved.
//

#import "MFStyler.h"
#import "MFFonts.h"
#import <MVMCoreUI/MFSizeObject.h>
#import "UIColor+MFConvenience.h"
#import "NSLayoutConstraint+MFConvenience.h"
#import "MVMCoreUISplitViewController.h"
@import MVMCore.MVMCoreDispatchUtility;
#import <MVMCoreUI/MVMCoreUIUtility.h>
#import <MVMCoreUI/MVMCoreUI-Swift.h>

CGFloat const PaddingDefault = 24;
CGFloat const PaddingDefaultHorizontalSpacing = 32;
CGFloat const PaddingDefaultVerticalSpacing = 32;
CGFloat const PaddingDefaultVerticalSpacing3 = 24;
CGFloat const PaddingBetweenFields = 24;
CGFloat const PaddingHorizontalHeadlineWhiteView = 60;
CGFloat const PaddingHorizontalLarge = 72;
CGFloat const PaddingVerticalWhiteGrayView = 72;
CGFloat const PaddingVerticalHeadlineAlternate = 48;
CGFloat const PaddingPrimaryButtonTop = 36;

CGFloat const PaddingHorizontalBetweenRelatedItems = 12;
CGFloat const PaddingOne = 6;
CGFloat const PaddingTwo = 12;
CGFloat const PaddingThree = 18;
CGFloat const PaddingFour = 24;
CGFloat const PaddingFive = 30;
CGFloat const PaddingSix = 36;
CGFloat const PaddingSeven = 42;
CGFloat const PaddingEight = 48;
CGFloat const PaddingNine = 54;
CGFloat const PaddingTen = 60;
CGFloat const TableCellParagraphSpace = 3.f;
CGFloat const FooterLabelParagraphSpace = 4.f;
CGFloat const WebViewInset = 8.f;

CGFloat const HeightTableSeperatorHeight = 1;

CGFloat const MFHeightForSwitch = 22;
CGFloat const MFWidthForSwitch = 42;

CGFloat const HeaderMaxWidth = 596;

CGFloat const DisableOppacity = 0.5;
CGFloat const PaymentMethodViewHeightWidthMultiplier = 0.55;
CGFloat const MinCellHeight = 96;
CGFloat const HeightIphone5 = 568;
CGFloat const DefaultOptionCellHeight = 120.0;
CGFloat const PromoViewHeight = 41.9;

CGFloat const LabelWithInternalButtonLineSpace = 2;

@implementation MFStyler

+ (CGFloat)splitTextFieldWidth {
    return [MFStyler splitTextFieldWidthForViewWidth:[MVMCoreUISplitViewController getDetailViewWidth]];
}

+ (CGFloat)splitTextFieldWidthForViewWidth:(CGFloat) width {
    return (width - PaddingOne)/2 - [MFStyler defaultHorizontalPaddingForApplicationWidth];
}

+ (nullable MFSizeObject *)sizeObjectGenericForCurrentDevice:(CGFloat)size {
    MFSizeObject *sizeObject = [MFSizeObject sizeObjectWithStandardSize:size standardiPadPortraitSize:size * 1.3];
    [sizeObject addLargerThanCustomSize:size * 1.4 forThreshold:MFSizeStandardiPadLandscapeThreshold];
    [sizeObject addLargerThanCustomSize:size * 1.5 forThreshold:MFSizeiPadProLandscapeThreshold];
    return sizeObject;
}

+ (CGFloat)sizeFontGenericForCurrentDevice:(CGFloat)size {
    return [[MFStyler sizeObjectGenericForCurrentDevice:size] getValueBasedOnApplicationWidth];
}

#pragma mark - Spacing Defaults
+ (CGFloat)defaultHorizontalPaddingForApplicationWidth {
    return [self bridgeHorizontalPaddingFor:[MVMCoreUISplitViewController getApplicationViewWidth]];
}

+ (CGFloat)defaultVerticalPaddingForApplicationWidth {
    return [self bridgeVerticalPaddingFor:[MVMCoreUISplitViewController getApplicationViewWidth]];
}

+ (CGFloat)defaultHorizontalPaddingForSize:(CGFloat)size {
    return [self bridgeHorizontalPaddingFor:size];
}

+ (CGFloat)defaultVerticalPaddingForSize:(CGFloat)size {
    return [self bridgeVerticalPaddingFor:size];
}

+ (void)setDefaultMarginsForView:(nullable UIView *)view size:(CGFloat)size {
    [self setDefaultMarginsForView:view size:size horizontal:YES vertical:NO];
}

+ (void)setDefaultMarginsForView:(nullable UIView *)view size:(CGFloat)size horizontal:(BOOL)horizontal vertical:(BOOL)vertical {
    if (!view) { return; }
    [self bridgeSetDefaultMarginsFor:view size:size horizontal:horizontal vertical:vertical];
}

+ (void)setMarginsForView:(nullable UIView *)view size:(CGFloat)size defaultHorizontal:(BOOL)horizontal top:(CGFloat)top bottom:(CGFloat)bottom {
    if (!view) { return; }
    [self bridgeSetMarginsFor:view size:size horizontal:horizontal top:top bottom:bottom];
}

#pragma mark - 3.0 fonts

+ (nonnull UIFont *)getMVA3FontSize:(CGFloat)size bold:(BOOL)isBold {
    if (isBold) {
        if (size >= 15) {
            return [MFFonts mfFontDSBold:size];
        } else {
            return [MFFonts mfFontTXBold:size];
        }
    } else {
        if (size >= 15) {
            return [MFFonts mfFontDSRegular:size];
        } else {
            return [MFFonts mfFontTXRegular:size];
        }
    }
}

+ (nonnull UIFont *)fontTitle2XLarge:(BOOL)genericScaling {
    CGFloat size = 36;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [self getMVA3FontSize:size bold:YES];
}

+ (nonnull UIFont *)fontTitle2XLarge {
    return [self fontTitle2XLarge:YES];
}

+ (nonnull UIFont *)fontTitleXLarge:(BOOL)genericScaling {
    CGFloat size = 32;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [self getMVA3FontSize:size bold:YES];
}
+ (nonnull UIFont *)fontTitleXLarge{
    return [self fontTitleXLarge:YES];
}

+ (nonnull UIFont *)fontBoldTitleLarge:(BOOL)genericScaling {
    CGFloat size = 24;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [self getMVA3FontSize:size bold:YES];
}

+ (nonnull UIFont *)fontBoldTitleLarge {
    return [self fontBoldTitleLarge:YES];
}

+ (nonnull UIFont *)fontRegularTitleLarge:(BOOL)genericScaling {
    CGFloat size = 24;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [self getMVA3FontSize:size bold:NO];
}

+ (nonnull UIFont *)fontRegularTitleLarge {
    return [self fontRegularTitleLarge:YES];
}

+ (nonnull UIFont *)fontBoldTitleMedium:(BOOL)genericScaling {
    CGFloat size = 20;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [self getMVA3FontSize:size bold:YES];
}

+ (nonnull UIFont *)fontBoldTitleMedium {
    return [self fontBoldTitleMedium:YES];
}

+ (nonnull UIFont *)fontRegularTitleMedium:(BOOL)genericScaling {
    CGFloat size = 20;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [self getMVA3FontSize:size bold:NO];
}

+ (nonnull UIFont *)fontRegularTitleMedium {
    return [self fontRegularTitleMedium:YES];
}

+ (nonnull UIFont *)fontBoldBodyLarge:(BOOL)genericScaling {
    CGFloat size = 16;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [self getMVA3FontSize:size bold:YES];
}

+ (nonnull UIFont *)fontBoldBodyLarge {
    return [self fontBoldBodyLarge:YES];
}

+ (nonnull UIFont *)fontRegularBodyLarge:(BOOL)genericScaling {
    CGFloat size = 16;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [self getMVA3FontSize:size bold:NO];
}

+ (nonnull UIFont *)fontRegularBodyLarge {
    return [self fontRegularBodyLarge:YES];
}

+ (nonnull UIFont *)fontBoldBodySmall:(BOOL)genericScaling {
    CGFloat size = 13;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [self getMVA3FontSize:size bold:YES];
}

+ (nonnull UIFont *)fontBoldBodySmall {
    return [self fontBoldBodySmall:YES];
}

+ (nonnull UIFont *)fontRegularBodySmall:(BOOL)genericScaling {
    CGFloat size = 13;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [self getMVA3FontSize:size bold:NO];
}

+ (nonnull UIFont *)fontRegularBodySmall {
    return [self fontRegularBodySmall:YES];
}

+ (nonnull UIFont *)fontBoldMicro:(BOOL)genericScaling {
    CGFloat size = 11;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [self getMVA3FontSize:size bold:YES];
}

+ (nonnull UIFont *)fontBoldMicro {
    return [self fontBoldMicro:YES];
}

+ (nonnull UIFont *)fontRegularMicro:(BOOL)genericScaling {
    CGFloat size = 11;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [self getMVA3FontSize:size bold:NO];
}

+ (nonnull UIFont *)fontRegularMicro {
    return [self fontRegularMicro:YES];
}


#pragma mark - 2.0 fonts

+ (nullable UIFont *)fontH1:(BOOL)genericScaling {
    CGFloat size = 40;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont75Bd:size];
}

+ (nullable UIFont *)fontH1 {
    return [self fontH1:YES];
}

+ (nullable UIFont *)fontH2:(BOOL)genericScaling {
    CGFloat size = 25;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont75Bd:size];
}

+ (nullable UIFont *)fontH2 {
    return [self fontH2:YES];
}

+ (nullable UIFont *)fontH3:(BOOL)genericScaling {
    CGFloat size = 18;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont75Bd:size];
}

+ (nullable UIFont *)fontH3 {
    return [self fontH3:YES];
}

+ (nullable UIFont *)fontH32:(BOOL)genericScaling {
    CGFloat size = 32;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont75Bd:size];
}

+ (nullable UIFont *)fontH32 {
    return [self fontH32:YES];
}

+ (nullable UIFont *)fontB1:(BOOL)genericScaling {
    CGFloat size = 13;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont75Bd:size];
}

+ (nullable UIFont *)fontB1 {
    return [self fontB1:YES];
}

+ (nullable UIFont *)fontB2:(BOOL)genericScaling {
    CGFloat size = 13;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont55Rg:size];
}

+ (nullable UIFont *)fontB2 {
    return [self fontB2:YES];
}

+ (nullable UIFont *)fontB3:(BOOL)genericScaling {
    CGFloat size = 11;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont55Rg:size];
}

+ (nullable UIFont *)fontB3 {
    return [self fontB3:YES];
}

+ (nullable UIFont *)fontB20:(BOOL)genericScaling {
    CGFloat size = 20;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont55Rg:size];
}

+ (nullable UIFont *)fontB20 {
    return [self fontB20:YES];
}

#pragma mark - 1.0 Fonts

+ (nullable UIFont *)fontForPlan:(BOOL)genericScaling {
    CGFloat size = 100;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont75Bd:size];
}

+ (nullable UIFont *)fontForPlan {
    return [self fontForPlan:YES];
}

+ (nullable UIFont *)fontForBiggerHeadLine:(BOOL)genericScaling {
    CGFloat size = 48;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont75Bd:size];
}

+ (nullable UIFont *)fontForBiggerHeadline {
    return [self fontForBiggerHeadLine:YES];
}

+ (nullable UIFont *)fontForHeadlineSmall:(BOOL)genericScaling {
    CGFloat size = 15;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont75Bd:size];
}

+ (nullable UIFont *)fontForHeadlineSmall2:(BOOL)genericScaling {
    CGFloat size = 16;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont75Bd:size];
}

+ (nullable UIFont *)fontForHeadlineSmall2ForWidth:(CGFloat)size {
    CGFloat pointSize = 16;
    pointSize = [[MFStyler sizeObjectGenericForCurrentDevice:pointSize] getValueBasedOnSize:size];
    return [MFFonts mfFont75Bd:pointSize];
}

+ (nullable UIFont *)fontB1ForWidth:(CGFloat)size {
    CGFloat pointSize = 13;
    pointSize = [[MFStyler sizeObjectGenericForCurrentDevice:pointSize] getValueBasedOnSize:size];
    return [MFFonts mfFont75Bd:pointSize];
}

+ (nullable UIFont *)fontForBodyWithSize:(CGFloat)size genericScaling:(BOOL)genericScaling {
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont55Rg:size];
}

+ (nullable UIFont *)fontB2ForWidth:(CGFloat)size {
    CGFloat pointSize = 13;
    pointSize = [[MFStyler sizeObjectGenericForCurrentDevice:pointSize] getValueBasedOnSize:size];
    return [MFFonts mfFont55Rg:pointSize];
}

+ (nullable UIFont *)fontForBodyWithSize:(CGFloat)size forWidth:(CGFloat)width {
    size = [[MFStyler sizeObjectGenericForCurrentDevice:size] getValueBasedOnSize:width];
    return [MFFonts mfFont55Rg:size];
}

+ (nullable UIFont *)fontforChatText:(BOOL)genericScaling {
    CGFloat size = 14;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont55Rg:size];
}

+ (nullable UIFont *)fontForAccountLandingGreeting:(BOOL)genericScaling {
    CGFloat size = 16;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont55Rg:size];
}

+ (nullable UIFont *)fontForProgressBarBottomLabel:(BOOL)genericScaling {
    CGFloat size = 10;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont55Rg:size];
}

+ (nullable UIFont *)fontForPrimaryButton:(BOOL)genericScaling {
    CGFloat size = 13;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFontTXBold:size];
}

+ (nullable UIFont *)fontForPrimaryButtonForWidth:(CGFloat)size {
    CGFloat pointSize = 13;
    pointSize = [[MFStyler sizeObjectGenericForCurrentDevice:pointSize] getValueBasedOnSize:size];
    return [MFFonts mfFontTXBold:pointSize];
}

+ (nullable UIFont *)fontForSmallButton:(BOOL)genericScaling {
    CGFloat size = 11;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFontTXBold:size];
}

+ (nullable UIFont *)fontForSmallButtonForWidth:(CGFloat)size {
    CGFloat pointSize = 11;
    pointSize = [[MFStyler sizeObjectGenericForCurrentDevice:pointSize] getValueBasedOnSize:size];
    return [MFFonts mfFontTXBold:pointSize];
}

+ (nullable UIFont *)fontForTextField:(BOOL)genericScaling {
    CGFloat size = 16;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont55Rg:size];
}

+ (nullable UIFont *)fontForTextFieldUnderLabel:(BOOL)genericScaling {
    CGFloat size = 12;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont55Rg:size];
}

+ (nullable UIFont *)fontForUnreadMessageOnSupport:(BOOL)genericScaling {
    CGFloat size = 10;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont75Bd:size];
}

+ (nullable UIFont *)font5GMessage:(BOOL)genericScaling {
    CGFloat size = 16;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont55Rg:size];
}

+ (nullable UIFont *)font5GMessage {
    return [self font5GMessage:YES];
}


+ (nullable UIFont *)fontForHeadlineAlternative:(BOOL)genericScaling {
    CGFloat size = 24;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont55Rg:size];
}

+ (nullable UIFont *)fontForHeadlineAlternativeForWidth:(CGFloat)size {
    CGFloat pointSize = 24;
    pointSize = [[MFStyler sizeObjectGenericForCurrentDevice:pointSize] getValueBasedOnSize:size];
    return [MFFonts mfFont55Rg:pointSize];
}

+ (nullable UIFont *)fontH255:(BOOL)genericScaling {
    CGFloat size = 25;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont55Rg:size];
}

+ (nullable UIFont *)fontForFeedCardTitle:(BOOL)genericScaling {
    CGFloat size = 16;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont75Bd:size];
}

+ (nullable UIFont *)fontForLargeLoyaltyHeaderTitle:(BOOL)genericScaling {
    CGFloat size = 60;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont75Bd:size];
}

+ (nullable UIFont *)fontForLoyaltyTitleSmall:(BOOL)genericScaling {
    CGFloat size = 42;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont75Bd:size];
}

+ (nullable UIFont *)fontForLoyaltyMessage:(BOOL)genericScaling {
    CGFloat size = 20;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont55Rg:size];
}

+ (nullable UIFont *)fontForPtPCard:(BOOL)genericScaling {
    CGFloat size = 22;
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont75Bd:size];
}

+ (nullable UIFont *)fontForLabelWithTopLeftCircleWithSize:(CGFloat)size genericScaling:(BOOL)genericScaling  {
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFont75Bd:size];
}

+ (nullable UIFont *)fontOcratxtWitSize:(CGFloat)size  genericScaling:(BOOL)genericScaling {
    if (genericScaling) {
        size = [self sizeFontGenericForCurrentDevice:size];
    }
    return [MFFonts mfFontOcratxt:size];
}

+ (nullable UIFont *)fontForHeadlineSmall {
    return [self fontForHeadlineSmall:YES];
}

+ (nullable UIFont *)fontForHeadlineSmall2 {
    return [self fontForHeadlineSmall2:YES];
}

+ (nullable UIFont *)fontforChatText {
    return [self fontforChatText:NO];
}

+ (nullable UIFont *)fontForAccountLandingGreeting {
    return [self fontForAccountLandingGreeting:YES];
}

+ (nullable UIFont *)fontForProgressBarBottomLabel {
    return [self fontForProgressBarBottomLabel:YES];
}

+ (nullable UIFont *)fontForPrimaryButton {
    return [self fontForPrimaryButton:YES];
}

+ (nullable UIFont *)fontForSmallButton {
    return [self fontForSmallButton:YES];
}

+ (nullable UIFont *)fontForTextField {
    return [self fontForTextField:YES];
}

+ (nullable UIFont *)fontForTextFieldUnderLabel {
    return [self fontForTextFieldUnderLabel:YES];
}

+ (nullable UIFont *)fontForHeadlineAlternative {
    return [self fontForHeadlineAlternative:YES];
}

+ (nullable UIFont *)fontForFeedCardTitle {
    return [self fontForFeedCardTitle:YES];
}

+ (nullable UIFont *)fontForLargeLoyaltyHeaderTitle {
    return [self fontForLargeLoyaltyHeaderTitle:YES];
}

+ (nullable UIFont *)fontForLoyaltyTitleSmall {
    return [self fontForLoyaltyTitleSmall:YES];
}

+ (nullable UIFont *)fontForLoyaltyMessage {
    return [self fontForLoyaltyMessage:YES];
}

+ (nullable UIFont *)fontForUnreadMessageOnSupport {
    return [self fontForUnreadMessageOnSupport:NO];
}

+ (nonnull UIFont *) boldFontForScaledSize:(CGFloat)size {
    return [MFFonts mfFont75Bd:[self sizeFontGenericForCurrentDevice:size]];
}

+ (nonnull UIFont *) regularFontForScaledSize:(CGFloat)size {
    return [MFFonts mfFont55Rg:[self sizeFontGenericForCurrentDevice:size]];
}

#pragma mark - 3.0 Styles

+ (void)styleLabelTitle2XLarge:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontTitle2XLarge:genericScaling];
    label.textColor = [UIColor blackColor];
}

+ (void)styleLabelTitle2XLarge:(nonnull UILabel *)label {
    [self styleLabelTitle2XLarge:label genericScaling:YES];
}

+ (void)styleLabelTitleXLarge:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontTitleXLarge:genericScaling];
    label.textColor = [UIColor blackColor];
}

+ (void)styleLabelTitleXLarge:(nonnull UILabel *)label {
    [self styleLabelTitleXLarge:label genericScaling:YES];
}

+ (void)styleLabelBoldTitleLarge:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontBoldTitleLarge:genericScaling];
    label.textColor = [UIColor blackColor];
}

+ (void)styleLabelBoldTitleLarge:(nonnull UILabel *)label {
    [self styleLabelBoldTitleLarge:label genericScaling:YES];
}

+ (void)styleLabelRegularTitleLarge:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontRegularTitleLarge:genericScaling];
    label.textColor = [UIColor blackColor];
}

+ (void)styleLabelRegularTitleLarge:(nonnull UILabel *)label {
    [self styleLabelBoldTitleLarge:label genericScaling:YES];
}

+ (void)styleLabelBoldTitleMedium:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontBoldTitleMedium:genericScaling];
    label.textColor = [UIColor blackColor];
}

+ (void)styleLabelBoldTitleMedium:(nonnull UILabel *)label {
    [self styleLabelBoldTitleMedium:label genericScaling:YES];
}

+ (void)styleLabelRegularTitleMedium:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontRegularTitleMedium:genericScaling];
    label.textColor = [UIColor blackColor];
}

+ (void)styleLabelRegularTitleMedium:(nonnull UILabel *)label {
    [self styleLabelRegularTitleMedium:label genericScaling:YES];
}

+ (void)styleLabelBoldBodyLarge:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontBoldBodyLarge:genericScaling];
    label.textColor = [UIColor blackColor];
}

+ (void)styleLabelBoldBodyLarge:(nonnull UILabel *)label {
    [self styleLabelBoldBodyLarge:label genericScaling:YES];
}

+ (void)styleLabelRegularBodyLarge:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontRegularBodyLarge:genericScaling];
    label.textColor = [UIColor blackColor];
}

+ (void)styleLabelRegularBodyLarge:(nonnull UILabel *)label {
    [self styleLabelRegularBodyLarge:label genericScaling:YES];
}

+ (void)styleLabelBoldBodySmall:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontBoldBodySmall:genericScaling];
    label.textColor = [UIColor blackColor];
}

+ (void)styleLabelBoldBodySmall:(nonnull UILabel *)label {
    [self styleLabelBoldBodySmall:label genericScaling:YES];
}

+ (void)styleLabelRegularBodySmall:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontRegularBodySmall:genericScaling];
    label.textColor = [UIColor blackColor];
}

+ (void)styleLabelRegularBodySmall:(nonnull UILabel *)label {
    [self styleLabelRegularBodySmall:label genericScaling:YES];
}

+ (void)styleLabelBoldMicro:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontBoldMicro:genericScaling];
    label.textColor = [UIColor blackColor];
}

+ (void)styleLabelBoldMicro:(nonnull UILabel *)label {
    [self styleLabelBoldMicro:label genericScaling:YES];
}

+ (void)styleLabelRegularMicro:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontRegularMicro:genericScaling];
    label.textColor = [UIColor blackColor];
}

+ (void)styleLabelRegularMicro:(nonnull UILabel *)label {
    [self styleLabelRegularMicro:label genericScaling:YES];
}

+ (BOOL)styleMVA3Label:(nonnull UILabel *)label withStyle:(nullable NSString *)style genericScaling:(BOOL)genericScaling {
    if ([style isEqualToString:@"Title2XLarge"]) {
        [self styleLabelTitle2XLarge:label genericScaling:genericScaling];
        return YES;
    } else if ([style isEqualToString:@"TitleXLarge"]) {
        [self styleLabelTitleXLarge:label genericScaling:genericScaling];
        return YES;
    } else if ([style isEqualToString:@"BoldTitleLarge"]) {
        [self styleLabelBoldTitleLarge:label genericScaling:genericScaling];
        return YES;
    } else if ([style isEqualToString:@"RegularTitleLarge"]) {
        [self styleLabelRegularTitleLarge:label genericScaling:genericScaling];
        return YES;
    } else if ([style isEqualToString:@"BoldTitleMedium"]) {
        [self styleLabelBoldTitleMedium:label genericScaling:genericScaling];
        return YES;
    } else if ([style isEqualToString:@"RegularTitleMedium"]) {
        [self styleLabelRegularTitleMedium:label genericScaling:genericScaling];
        return YES;
    } else if ([style isEqualToString:@"BoldBodyLarge"]) {
        [self styleLabelBoldBodyLarge:label genericScaling:genericScaling];
        return YES;
    } else if ([style isEqualToString:@"RegularBodyLarge"]) {
        [self styleLabelRegularBodyLarge:label genericScaling:genericScaling];
        return YES;
    } else if ([style isEqualToString:@"BoldBodySmall"]) {
        [self styleLabelBoldBodySmall:label genericScaling:genericScaling];
        return YES;
    } else if ([style isEqualToString:@"RegularBodySmall"]) {
        [self styleLabelRegularBodySmall:label genericScaling:genericScaling];
        return YES;
    } else if ([style isEqualToString:@"BoldMicro"]) {
        [self styleLabelBoldMicro:label genericScaling:genericScaling];
        return YES;
    } else if ([style isEqualToString:@"RegularMicro"]) {
        [self styleLabelRegularMicro:label genericScaling:genericScaling];
        return YES;
    } else {
        return NO;
    }
}


#pragma mark - 2.0 Styles

+ (void)styleLabel:(nonnull UILabel *)label withStyle:(nullable NSString *)style genericScaling:(BOOL)genericScaling {
    if ([self styleMVA3Label:label withStyle:style genericScaling:genericScaling]) {
        //try mva 3.0 font first
    } else if ([style isEqualToString:@"H1"]) {
        [self styleLabelH1:label genericScaling:genericScaling];
    } else if ([style isEqualToString:@"H2"]) {
        [self styleLabelH2:label genericScaling:genericScaling];
    } else if ([style isEqualToString:@"H3"]) {
        [self styleLabelH3:label genericScaling:genericScaling];
    } else if ([style isEqualToString:@"H32"]) {
        [self styleLabelH32:label genericScaling:genericScaling];
    } else if ([style isEqualToString:@"B1"]) {
        [self styleLabelB1:label genericScaling:genericScaling];
    } else if ([style isEqualToString:@"B3"]) {
        [self styleLabelB3:label genericScaling:genericScaling];
    } else if ([style isEqualToString:@"B20"]) {
        [self styleLabelB20:label genericScaling:genericScaling];
    } else {
        [self styleLabelB2:label genericScaling:genericScaling];
    }
}

+ (void)styleLabel:(nonnull UILabel *)label withStyle:(nullable NSString *)style {
    [self styleLabel:label withStyle:style genericScaling:YES];
}

+ (void)styleLabelH1:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontH1:genericScaling];
    label.textColor = [UIColor blackColor];
}

+ (void)styleLabelH1:(nonnull UILabel *)label {
    [self styleLabelH1:label genericScaling:YES];
}

+ (void)styleLabelH2:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontH2:genericScaling];
    label.textColor = [UIColor blackColor];
}

+ (void)styleLabelH2:(nonnull UILabel *)label {
    [self styleLabelH2:label genericScaling:YES];
}

+ (void)styleLabelH3:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontH3:genericScaling];
    label.textColor = [UIColor blackColor];
}

+ (void)styleLabelH3:(nonnull UILabel *)label {
    [self styleLabelH3:label genericScaling:YES];
}

+ (void)styleLabelH32:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontH32:genericScaling];
    label.textColor = [UIColor blackColor];
}

+ (void)styleLabelH32:(nonnull UILabel *)label {
    [self styleLabelH32:label genericScaling:YES];
}

+ (void)styleLabelB1:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontB1:genericScaling];
    label.textColor = [UIColor blackColor];
}

+ (void)styleLabelB1:(nonnull UILabel *)label {
    [self styleLabelB1:label genericScaling:YES];
}

+ (void)styleLabelB2:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontB2:genericScaling];
    label.textColor = [UIColor blackColor];
}

+ (void)styleLabelB2:(nonnull UILabel *)label {
    [self styleLabelB2:label genericScaling:YES];
}

+ (void)styleLabelB2:(nonnull UILabel *)label size:(CGFloat)size genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontForBodyWithSize:size genericScaling:genericScaling];
}

+ (void)styleLabelB3:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontB3:genericScaling];
    label.textColor = [UIColor mfBattleshipGrey];
}

+ (void)styleLabelB3:(nonnull UILabel *)label {
    [self styleLabelB3:label genericScaling:YES];
}

+ (void)styleLabelB20:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontB20:genericScaling];
    label.textColor = [UIColor blackColor];
}

+ (void)styleLabelB20:(nonnull UILabel *)label {
    [self styleLabelB20:label genericScaling:YES];
}

+ (void)styleLabelTextStyle2:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontB2:genericScaling];
    label.textColor = [UIColor mfBattleshipGrey];
}

+ (void)styleLabelTextStyle2:(nonnull UILabel *)label {
    [self styleLabelTextStyle2:label genericScaling:YES];
}


#pragma mark - 1.0 Styles

+ (void)styleFeedCardTitleLabel:(nonnull UILabel *)label {
    label.font = [MFStyler fontForFeedCardTitle];
    label.textColor = [UIColor blackColor];
}

+ (void)styleFeedCardTagLabel:(nonnull UILabel *)label {
    label.font = [MFStyler fontB3];
    label.textColor = [UIColor mfBrownishGrey];
}

+ (void)styleStandardSeparatorView:(nonnull UIView *)view {
    [view setBackgroundColor:[UIColor mfBackgroundGray]];
}

+ (void)styleLabelHeadlineSmall:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontForHeadlineSmall:genericScaling];
    label.textColor = [UIColor blackColor];
}

+ (void)styleFeedCardTitleLabel:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontForFeedCardTitle:genericScaling];
    label.textColor = [UIColor blackColor];
}

+ (void)styleFeedCardTagLabel:(nonnull UILabel *)label genericScaling:(BOOL)genericScaling {
    label.font = [MFStyler fontB3:genericScaling];
    label.textColor = [UIColor mfBrownishGrey];
}

#pragma mark - Attributed Strings

+ (nonnull NSAttributedString *)styleGetAttributedString:(nullable NSString *)string withStyle:(nullable NSString *)style {
    return [self styleGetAttributedString:string withStyle:style genericScaling:YES];
}
    
+ (nonnull NSAttributedString *)styleGetAttributedString:(nullable NSString *)string withStyle:(nullable NSString *)style genericScaling:(BOOL)genericScaling {
    if ([style isEqualToString:@"H1"]) {
        return [self styleGetH1AttributedString:string genericScaling:genericScaling];
    } else if ([style isEqualToString:@"H2"]) {
        return [self styleGetH2AttributedString:string genericScaling:genericScaling];
    } else if ([style isEqualToString:@"H3"]) {
        return [self styleGetH3AttributedString:string genericScaling:genericScaling];
    } else if ([style isEqualToString:@"H32"]) {
        return [self styleGetH32AttributedString:string genericScaling:genericScaling];
    } else if ([style isEqualToString:@"B1"]) {
        return [self styleGetB1AttributedString:string genericScaling:genericScaling];
    } else if ([style isEqualToString:@"B3"]) {
        return [self styleGetB3AttributedString:string genericScaling:genericScaling];
    } else if ([style isEqualToString:@"B20"]) {
        return [self styleGetB20AttributedString:string genericScaling:genericScaling];
    } else {
        return [self styleGetB2AttributedString:string genericScaling:genericScaling];
    }
}

+ (nonnull NSAttributedString *)styleGetAttributedString:(nullable NSString *)string font:(nonnull UIFont *)font color:(nonnull UIColor *)color {
    NSAttributedString *attributedString = nil;
    if (![string isEqual:[NSNull null]] && string.length > 0) {
        attributedString = [[NSAttributedString alloc] initWithString:string attributes:@{
                                                                                          NSFontAttributeName:font,
                                                                                          NSForegroundColorAttributeName:color
                                                                                          }];
    } else {
        attributedString = [[NSAttributedString alloc] initWithString:@""];
    }
    
    return attributedString;
}


+ (nonnull NSAttributedString *)styleGetTitle2XLargeAttributedString:(nullable NSString *)string {
    return [MFStyler styleGetTitle2XLargeAttributedString:string genericScaling:YES];
}

+ (nonnull NSAttributedString *)styleGetTitle2XLargeAttributedString:(nullable NSString *)string genericScaling:(BOOL)genericScaling {
    return [MFStyler styleGetAttributedString:string font:[MFStyler fontTitle2XLarge:genericScaling] color:[UIColor blackColor]];
}

+ (nonnull NSAttributedString *)styleGetTitleXLargeAttributedString:(nullable NSString *)string {
    return [MFStyler styleGetTitleXLargeAttributedString:string genericScaling:YES];
}

+ (nonnull NSAttributedString *)styleGetTitleXLargeAttributedString:(nullable NSString *)string genericScaling:(BOOL)genericScaling {
    return [MFStyler styleGetAttributedString:string font:[MFStyler fontTitleXLarge:genericScaling] color:[UIColor blackColor]];
}

+ (nonnull NSAttributedString *)styleGetBoldTitleLargeAttributedString:(nullable NSString *)string {
    return [MFStyler styleGetBoldTitleLargeAttributedString:string genericScaling:YES];
}

+ (nonnull NSAttributedString *)styleGetBoldTitleLargeAttributedString:(nullable NSString *)string genericScaling:(BOOL)genericScaling {
    return [MFStyler styleGetAttributedString:string font:[MFStyler fontBoldTitleLarge:genericScaling] color:[UIColor blackColor]];
}

+ (nonnull NSAttributedString *)styleGetRegularTitleLargeAttributedString:(nullable NSString *)string {
    return [MFStyler styleGetRegularTitleLargeAttributedString:string genericScaling:YES];
}

+ (nonnull NSAttributedString *)styleGetRegularTitleLargeAttributedString:(nullable NSString *)string genericScaling:(BOOL)genericScaling {
    return [MFStyler styleGetAttributedString:string font:[MFStyler fontRegularTitleLarge:genericScaling] color:[UIColor blackColor]];
}

+ (nonnull NSAttributedString *)styleGetBoldTitleMediumAttributedString:(nullable NSString *)string {
    return [MFStyler styleGetBoldTitleMediumAttributedString:string genericScaling:YES];
}

+ (nonnull NSAttributedString *)styleGetBoldTitleMediumAttributedString:(nullable NSString *)string genericScaling:(BOOL)genericScaling {
    return [MFStyler styleGetAttributedString:string font:[MFStyler fontBoldTitleMedium:genericScaling] color:[UIColor blackColor]];
}

+ (nonnull NSAttributedString *)styleGetRegularTitleMediumAttributedString:(nullable NSString *)string {
    return [MFStyler styleGetRegularTitleMediumAttributedString:string genericScaling:YES];
}

+ (nonnull NSAttributedString *)styleGetRegularTitleMediumAttributedString:(nullable NSString *)string genericScaling:(BOOL)genericScaling {
    return [MFStyler styleGetAttributedString:string font:[MFStyler fontRegularTitleMedium:genericScaling] color:[UIColor blackColor]];
}

+ (nonnull NSAttributedString *)styleGetBoldBodyLargeAttributedString:(nullable NSString *)string {
    return [MFStyler styleGetBoldBodyLargeAttributedString:string genericScaling:YES];
}

+ (nonnull NSAttributedString *)styleGetBoldBodyLargeAttributedString:(nullable NSString *)string genericScaling:(BOOL)genericScaling {
    return [MFStyler styleGetAttributedString:string font:[MFStyler fontBoldBodyLarge:genericScaling] color:[UIColor blackColor]];
}

+ (nonnull NSAttributedString *)styleGetRegularBodyLargeAttributedString:(nullable NSString *)string {
    return [MFStyler styleGetRegularBodyLargeAttributedString:string genericScaling:YES];
}

+ (nonnull NSAttributedString *)styleGetRegularBodyLargeAttributedString:(nullable NSString *)string genericScaling:(BOOL)genericScaling {
    return [MFStyler styleGetAttributedString:string font:[MFStyler fontRegularBodyLarge:genericScaling] color:[UIColor blackColor]];
}

+ (nonnull NSAttributedString *)styleGetBoldBodySmallAttributedString:(nullable NSString *)string {
    return [MFStyler styleGetBoldBodySmallAttributedString:string genericScaling:YES];
}

+ (nonnull NSAttributedString *)styleGetBoldBodySmallAttributedString:(nullable NSString *)string genericScaling:(BOOL)genericScaling {
    return [MFStyler styleGetAttributedString:string font:[MFStyler fontBoldBodySmall:genericScaling] color:[UIColor blackColor]];
}

+ (nonnull NSAttributedString *)styleGetRegularBodySmallAttributedString:(nullable NSString *)string {
    return [MFStyler styleGetRegularBodySmallAttributedString:string genericScaling:YES];
}

+ (nonnull NSAttributedString *)styleGetRegularBodySmallAttributedString:(nullable NSString *)string genericScaling:(BOOL)genericScaling {
    return [MFStyler styleGetAttributedString:string font:[MFStyler fontRegularBodySmall:genericScaling] color:[UIColor blackColor]];
}

+ (nonnull NSAttributedString *)styleGetBoldMicroAttributedString:(nullable NSString *)string {
    return [MFStyler styleGetBoldMicroAttributedString:string genericScaling:YES];
}

+ (nonnull NSAttributedString *)styleGetBoldMicroAttributedString:(nullable NSString *)string genericScaling:(BOOL)genericScaling {
    return [MFStyler styleGetAttributedString:string font:[MFStyler fontBoldMicro:genericScaling] color:[UIColor blackColor]];
}

+ (nonnull NSAttributedString *)styleGetRegularMicroAttributedString:(nullable NSString *)string {
    return [MFStyler styleGetRegularMicroAttributedString:string genericScaling:YES];
}

+ (nonnull NSAttributedString *)styleGetRegularMicroAttributedString:(nullable NSString *)string genericScaling:(BOOL)genericScaling {
    return [MFStyler styleGetAttributedString:string font:[MFStyler fontRegularMicro:genericScaling] color:[UIColor blackColor]];
}


//2.0 font get attributedString
+ (nonnull NSAttributedString *)styleGetH1AttributedString:(nullable NSString *)string {
    return [MFStyler styleGetH1AttributedString:string genericScaling:YES];
}

+ (nonnull NSAttributedString *)styleGetH1AttributedString:(nullable NSString *)string genericScaling:(BOOL)genericScaling {
    return [MFStyler styleGetAttributedString:string font:[MFStyler fontH1:genericScaling] color:[UIColor blackColor]];
}

+ (nonnull NSAttributedString *)styleGetH2AttributedString:(nullable NSString *)string {
    return [MFStyler styleGetH2AttributedString:string genericScaling:YES];
}

+ (nonnull NSAttributedString *)styleGetH2AttributedString:(nullable NSString *)string genericScaling:(BOOL)genericScaling {
    return [MFStyler styleGetAttributedString:string font:[MFStyler fontH2:genericScaling] color:[UIColor blackColor]];
}

+ (nonnull NSAttributedString *)styleGetH3AttributedString:(nullable NSString *)string {
    return [MFStyler styleGetH3AttributedString:string genericScaling:YES];
}

+ (nonnull NSAttributedString *)styleGetH3AttributedString:(nullable NSString *)string genericScaling:(BOOL)genericScaling {
    return [MFStyler styleGetAttributedString:string font:[MFStyler fontH3:genericScaling] color:[UIColor blackColor]];
}

+ (nonnull NSAttributedString *)styleGetH32AttributedString:(nullable NSString *)string {
    return [MFStyler styleGetH32AttributedString:string genericScaling:YES];
}

+ (nonnull NSAttributedString *)styleGetH32AttributedString:(nullable NSString *)string genericScaling:(BOOL)genericScaling {
    return [MFStyler styleGetAttributedString:string font:[MFStyler fontH32:genericScaling] color:[UIColor blackColor]];
}

+ (nonnull NSAttributedString *)styleGetB1AttributedString:(nullable NSString *)string {
    return [MFStyler styleGetB1AttributedString:string genericScaling:YES];
}

+ (nonnull NSAttributedString *)styleGetB1AttributedString:(nullable NSString *)string genericScaling:(BOOL)genericScaling {
    return [MFStyler styleGetAttributedString:string font:[MFStyler fontB1:genericScaling] color:[UIColor blackColor]];
}

+ (nonnull NSAttributedString *)styleGetB2AttributedString:(nullable NSString *)string {
    return [MFStyler styleGetB2AttributedString:string genericScaling:YES];
}

+ (nonnull NSAttributedString *)styleGetB2AttributedString:(nullable NSString *)string genericScaling:(BOOL)genericScaling {
    return [MFStyler styleGetAttributedString:string font:[MFStyler fontB2:genericScaling] color:[UIColor blackColor]];
}

+ (nonnull NSAttributedString *)styleGetB3AttributedString:(nullable NSString *)string {
    return [MFStyler styleGetB3AttributedString:string genericScaling:YES];
}

+ (nonnull NSAttributedString *)styleGetB3AttributedString:(nullable NSString *)string genericScaling:(BOOL)genericScaling {
    return [MFStyler styleGetAttributedString:string font:[MFStyler fontB3:genericScaling] color:[UIColor mfBattleshipGrey]];
}

+ (nonnull NSAttributedString *)styleGetB20AttributedString:(nullable NSString *)string {
    return [MFStyler styleGetB20AttributedString:string genericScaling:YES];
}

+ (nonnull NSAttributedString *)styleGetB20AttributedString:(nullable NSString *)string genericScaling:(BOOL)genericScaling {
    return [MFStyler styleGetAttributedString:string font:[MFStyler fontB20:genericScaling] color:[UIColor blackColor]];
}

+ (nonnull NSAttributedString *)styleGetDisabledB1AttributedString:(nullable NSString *)string {
    return [MFStyler styleGetAttributedString:string font:[MFStyler fontB1] color:[UIColor mfLighterGrayColor]];
}

+ (nonnull NSAttributedString *)styleGetDisabledB2AttributedString:(nullable NSString *)string {
    return [MFStyler styleGetAttributedString:string font:[MFStyler fontB2] color:[UIColor mfLighterGrayColor]];
}

+ (nonnull NSAttributedString *)styleGetTopAlignedAttributeStringWithLeftString:(nullable NSString *)left centerString:(nonnull NSString *)center rightString:(nullable NSString *)right withCenterStringFontSize:(CGFloat)fontSize andColor:(nonnull UIColor *)color {
    if (left == nil){
        left = @"";
    }
    if (center == nil) {
        center = @"";
    }
    if (right == nil){
        right = @"";
    }
    NSString *text = [NSString stringWithFormat:@"%@%@%@",
                      left,
                      center,
                      right];
    NSDictionary *attribs = @{
                              NSForegroundColorAttributeName:color,
                              };
    NSMutableAttributedString *attributedText =
    [[NSMutableAttributedString alloc] initWithString:text
                                           attributes:attribs];
    
    //center
    NSRange centerRange = [text rangeOfString:center];
    UIFont *centerFont = [MFFonts mfFont75Bd:fontSize];
    CGFloat centerHeight = centerFont.capHeight;
    [attributedText  addAttributes:@{NSFontAttributeName:[MFFonts mfFont75Bd:fontSize]}
                            range:centerRange];
    //left
    NSRange leftRange = [text rangeOfString:left];
    UIFont *leftFont = [MFFonts mfFont75Bd:fontSize*0.34];
    CGFloat leftHeight = leftFont.capHeight;
    [attributedText addAttributes:@{NSFontAttributeName:leftFont,
                                    NSBaselineOffsetAttributeName: @(centerHeight - leftHeight)
                                    }
                            range:leftRange];
    
    //right
    NSRange rightRange = NSMakeRange(centerRange.location+centerRange.length, right.length);
    UIFont *rightFont = [MFFonts mfFont75Bd:fontSize*0.34];
    CGFloat rightHeight = rightFont.capHeight;
    [attributedText addAttributes:@{NSFontAttributeName:rightFont,
                                    NSBaselineOffsetAttributeName: @(centerHeight - rightHeight)
                                    }
                            range:rightRange];
    
    return attributedText;
}

+ (nonnull NSAttributedString *)styleGetTopAlignedAttributeStringWithLeftStringRightTop:(nullable NSString *)left centerString:(nonnull NSString *)center rightString:(nullable NSString *)right withCenterStringFontSize:(CGFloat)fontSize andColor:(nonnull UIColor *)color {
    if (left == nil){
        left = @"";
    }
    if (center == nil) {
        center = @"";
    }
    if (right == nil){
        right = @"";
    }
    NSString *text = [NSString stringWithFormat:@"%@%@%@",
                      left,
                      center,
                      right];
    NSDictionary *attribs = @{
                              NSForegroundColorAttributeName:color,
                              };
    NSMutableAttributedString *attributedText =
    [[NSMutableAttributedString alloc] initWithString:text
                                           attributes:attribs];
    
    //center
    NSRange centerRange = [text rangeOfString:center];
    UIFont *centerFont = [MFFonts mfFont75Bd:fontSize];
    CGFloat centerHeight = centerFont.capHeight;
    [attributedText  addAttributes:@{NSFontAttributeName:[MFFonts mfFont75Bd:fontSize]}
                             range:centerRange];
    //left
    NSRange leftRange = [text rangeOfString:left];
    UIFont *leftFont = [MFFonts mfFont75Bd:fontSize*0.34];
    CGFloat leftHeight = leftFont.capHeight;
    [attributedText addAttributes:@{NSFontAttributeName:leftFont,
                                    NSBaselineOffsetAttributeName: @(centerHeight - leftHeight)
                                    }
                            range:leftRange];
    
    //right
    NSRange rightRange = NSMakeRange(centerRange.location+centerRange.length, right.length);
    UIFont *rightFont = [MFFonts mfFont75Bd:fontSize*0.34];
    [attributedText addAttributes:@{NSFontAttributeName:rightFont,
                                    NSBaselineOffsetAttributeName: @(centerFont.pointSize - centerFont.capHeight + rightFont.pointSize/2)
                                    }
                            range:rightRange];
    
    return attributedText;
}

+ (void)styleGetAlignCenteredAttrituedString:(nullable NSMutableAttributedString *)string {
    if (string.length > 0) {
        NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
        paragraphStyle.alignment = NSTextAlignmentCenter;
        [string addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, string.length)];
    }
}

+(NSAttributedString *)styleGetBoldStringWithFont:(UIFont *)inputFont fromString:(NSString *)inputString{
        NSRange openingRange = [inputString rangeOfString:@"{"];
        NSRange closingRange = [inputString rangeOfString:@"}"];
        NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:inputString];
        if(openingRange.location!=NSNotFound && closingRange.location!=NSNotFound){
            NSUInteger boldLength = closingRange.location-openingRange.location;
            [attrString setAttributes:@{NSFontAttributeName:inputFont} range:NSMakeRange(openingRange.location,boldLength)];
            [attrString replaceCharactersInRange:closingRange withString:@""];
            [attrString replaceCharactersInRange:openingRange withString:@""];
        }
        return attrString;
}


+(NSString *)styleGetLowCaseSpace:(NSString *)inputString{
    if (inputString.length>0) {
        NSString *trimmedString = [[inputString lowercaseString] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
        return trimmedString;
    }else {
        return @"";
    }
    
}

#pragma mark - Gradient Colors
+ (nonnull NSArray *)gradientSpecialTicketGold {
    return @[[UIColor colorWithRed:.72 green:.6 blue:.33 alpha:1],
             [UIColor colorWithRed:1 green:.85 blue:.52 alpha:1],
             [UIColor colorWithRed:1 green:.85 blue:.52 alpha:1],
             [UIColor colorWithRed:1 green:.85 blue:.52 alpha:1],
             [UIColor colorWithRed:.6 green:.42 blue:.07 alpha:1]];
}

+ (nonnull NSArray *)gradientSpecialTicketGoldCGColor {
    return @[(id)[UIColor colorWithRed:.72 green:.6 blue:.33 alpha:1].CGColor,
             (id)[UIColor colorWithRed:1 green:.85 blue:.52 alpha:1].CGColor,
             (id)[UIColor colorWithRed:1 green:.85 blue:.52 alpha:1].CGColor,
             (id)[UIColor colorWithRed:1 green:.85 blue:.52 alpha:1].CGColor,
             (id)[UIColor colorWithRed:.6 green:.42 blue:.07 alpha:1].CGColor];
}

#pragma mark - Custom Styling Views

+ (void)styleView:(nonnull UIView *)view showMFViewBorder:(MFViewBorder)border withColor:(UIColor *)color borderLineWidth:(CGFloat)borderLineWidth borderLineLength:(CGFloat)borderLineLengh {
    UIView *borderLine = [[UIView alloc]initWithFrame:CGRectZero];
    borderLine.translatesAutoresizingMaskIntoConstraints = NO;
    [view addSubview:borderLine];
    switch (border) {
        case MFViewBorderTop: {
            [NSLayoutConstraint constraintPinSubview:borderLine pinTop:YES pinBottom:NO pinLeft:NO pinRight:NO];
            [NSLayoutConstraint constraintPinView:borderLine heightConstraint:YES heightConstant:borderLineWidth widthConstraint:YES widthConstant:borderLineLengh];
            [NSLayoutConstraint constraintPinSubview:borderLine pinCenterX:YES pinCenterY:NO];
            
            break;
        }
        case  MFViewBorderLeft: {
            [NSLayoutConstraint constraintPinSubview:borderLine pinTop:NO pinBottom:NO pinLeft:YES pinRight:NO];
            [NSLayoutConstraint constraintPinView:borderLine heightConstraint:YES heightConstant:borderLineLengh widthConstraint:YES widthConstant:borderLineWidth];
            [NSLayoutConstraint constraintPinSubview:borderLine pinCenterX:NO pinCenterY:YES];
            break;
        }
        case MFViewBorderBottom: {
            [NSLayoutConstraint constraintPinSubview:borderLine pinTop:NO pinBottom:YES pinLeft:NO pinRight:NO];
            [NSLayoutConstraint constraintPinView:borderLine heightConstraint:YES heightConstant:borderLineWidth widthConstraint:YES widthConstant:borderLineLengh];
            [NSLayoutConstraint constraintPinSubview:borderLine pinCenterX:YES pinCenterY:NO];
            break;
        }
        case MFViewBorderRight: {
            [NSLayoutConstraint constraintPinSubview:borderLine pinTop:NO pinBottom:NO pinLeft:NO pinRight:YES];
            [NSLayoutConstraint constraintPinView:borderLine heightConstraint:YES heightConstant:borderLineLengh widthConstraint:YES widthConstant:borderLineWidth];
            [NSLayoutConstraint constraintPinSubview:borderLine pinCenterX:NO pinCenterY:YES];
            break;
        }
        default:
            break;
    }
    borderLine.backgroundColor = color;
    
}

+ (void)styleTextField:(nonnull UITextField *)textField {
    textField.font = [MFStyler fontForTextField];
    // As per AKQA
    /*  If the length of the text field exceeds the amount of space, the size of the text drops down.
     So, the entire line of copy can be read.
     16 point font size is the lowest recommended size.
     */
    textField.minimumFontSize = 16;
    textField.adjustsFontSizeToFitWidth = YES;// default is NO. if YES, text will shrink to minFontSize along baseline
}

+ (UIImage *)grayscaleImage:(UIImage *)image {
    UIGraphicsBeginImageContextWithOptions(image.size, YES, 1.0);
    CGRect imageRect = CGRectMake(0, 0, image.size.width, image.size.height);
    
    // Draw the image with the luminosity blend mode.
    // On top of a white background, this will give a black and white image.
    [image drawInRect:imageRect blendMode:kCGBlendModeLuminosity alpha:1.0];
    
    // Get the resulting image.
    UIImage *filteredImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    
    return filteredImage;    
}

+(void)setGradientToLabel:(nonnull UILabel*)label withColors:(nonnull NSArray*)colors {
    
    CGSize textSize = [label.text sizeWithAttributes: @{NSBaselineOffsetAttributeName : @0,
                                                        NSFontAttributeName: [UIFont fontWithName:label.font.fontName size:label.font.lineHeight]}];
    CGFloat width = textSize.width > 1024 ? 1024 : textSize.width;         // max 1024 due to Core Graphics limitations
    CGFloat height = textSize.height > 1024 ? 1024 : textSize.height;       // max 1024 due to Core Graphics limitations
    
    // create a new bitmap image context
    UIGraphicsBeginImageContext(CGSizeMake(width, height));
    
    // get context
    CGContextRef context = UIGraphicsGetCurrentContext();
    
    // push context to make it current (need to do this manually because we are not drawing in a UIView)
    UIGraphicsPushContext(context);
    
    //draw gradient
    CGGradientRef glossGradient;
    CGColorSpaceRef rgbColorspace;
    size_t num_locations = colors.count;
    CGFloat locations[colors.count];
    CGFloat components[colors.count * 4];
    int componentIndex = 0;
    for (int i = 0; i < colors.count; i++) {
        locations[i] = (1.0/(float)colors.count) * i;
        UIColor *color = colors[i];
        const CGFloat* colorComponents = CGColorGetComponents(color.CGColor);
        for (int component = 0; component < 4; component++) {
            components[componentIndex] = colorComponents[component];
            componentIndex++;
        }
    }
    
    rgbColorspace = CGColorSpaceCreateDeviceRGB();
    glossGradient = CGGradientCreateWithColorComponents(rgbColorspace, components, locations, num_locations);
    CGPoint topCenter = CGPointMake(0, 0);
    CGPoint bottomCenter = CGPointMake(textSize.width,0);
    CGContextDrawLinearGradient(context, glossGradient, topCenter, bottomCenter, 0);
    
    CGGradientRelease(glossGradient);
    CGColorSpaceRelease(rgbColorspace);
    
    // pop context
    UIGraphicsPopContext();
    
    // get a UIImage from the image context
    UIImage *gradientImage = UIGraphicsGetImageFromCurrentImageContext();
    
    // clean up drawing environment
    UIGraphicsEndImageContext();
    
    label.textColor   = [UIColor colorWithPatternImage:gradientImage];
}

+(NSDictionary *)labelStrokeAttributes:(UIColor*)color {
    return @{NSStrokeColorAttributeName : color,
             NSStrokeWidthAttributeName : @-1.0};
}

+ (void)mfStyleBlackPageControl:(UIPageControl *)pageControl {
    pageControl.pageIndicatorTintColor = [UIColor mfLighterGrayColor];
    pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
}

+ (void)mfStylePageControl:(UIPageControl *)pageControl {
    pageControl.pageIndicatorTintColor = [UIColor mfLighterGrayColor];
    pageControl.currentPageIndicatorTintColor = [UIColor mfRedColor];
}

+ (NSString *)getCountTime:(NSInteger)leftTime timeformat:(NSString *)timeFormat timeUnit:(MFTimeFormatUnit)timeUnit timeSuffix:(NSString *)suffix {

    int seconds = leftTime % 60;
    int minutes = (leftTime / 60) % 60;
    int hours = (leftTime / 3600) % 24;
    long days = (leftTime / 86400);
    
    NSArray *times = [timeFormat componentsSeparatedByString:@":"];
    NSMutableString *timeString = [NSMutableString new];
    if ([times containsObject:@"DD"]) {
        [timeString appendString:[NSString stringWithFormat:@"%02ld",days]];
        if (timeUnit == MFTimeFormatNormal) {
            NSString *dayKey = (days <= 1) ? @"CountDownDay": @"CountDownDays";
            NSString *dayUnit = [MVMCoreUIUtility hardcodedStringWithKey:dayKey];
            [timeString appendString:dayUnit];
        } else if (timeUnit == MFTimeFormatColon && ![[times lastObject] isEqualToString:@"DD"]) {
            [timeString appendString:@" : "];
        }
        if (![[times lastObject] isEqualToString:@"DD"] && suffix) {
            [timeString appendString:suffix];
        }
    }
    if ([times containsObject:@"HH"]) {
        if (![times containsObject:@"DD"]) {
            hours = (int)(leftTime / 3600);
        }
        [timeString appendString:[NSString stringWithFormat:@"%02d",hours]];
        if (timeUnit == MFTimeFormatNormal) {
            NSString *hourKey = (hours <= 1) ? @"CountDownHour": @"CountDownHours";
            NSString *hourUnit = [MVMCoreUIUtility hardcodedStringWithKey:hourKey];
            [timeString appendString:hourUnit];
        } else if (timeUnit == MFTimeFormatColon && ![[times lastObject] isEqualToString:@"HH"]) {
            [timeString appendString:@" : "];
        }
        if (![[times lastObject] isEqualToString:@"HH"] && suffix) {
            [timeString appendString:suffix];
        }
    }
    if ([times containsObject:@"MM"]) {
        if (![times containsObject:@"HH"]) {
            if (![times containsObject:@"DD"]) {
                minutes = (int)(leftTime / 60);
            } else {
                minutes = (int)((leftTime - days * 86400) / 60);
            }
        }
        [timeString appendString:[NSString stringWithFormat:@"%02d",minutes]];
        if (timeUnit == MFTimeFormatNormal) {
            NSString *minKey = (minutes <= 1) ? @"CountDownMin": @"CountDownMins";
            NSString *minuteUnit = [MVMCoreUIUtility hardcodedStringWithKey:minKey];
            [timeString appendString:minuteUnit];
        } else if (timeUnit == MFTimeFormatColon && ![[times lastObject] isEqualToString:@"MM"]) {
            [timeString appendString:@" : "];
        }
        if (![[times lastObject] isEqualToString:@"MM"] && suffix) {
            [timeString appendString:suffix];
        }
    }
    
    if ([times containsObject:@"SS"]) {
        if (![times containsObject:@"MM"]) {
            if (![times containsObject:@"HH"]) {
                if (![times containsObject:@"DD"]) {
                    seconds = (int)leftTime;
                } else {
                    seconds = (int)(leftTime % 86400);
                }
            } else {
                seconds = (int)(leftTime % 3600);
            }
        }
        [timeString appendString:[NSString stringWithFormat:@"%02d",seconds]];
        if (timeUnit == MFTimeFormatNormal) {
            NSString *secondKey = (seconds <= 1) ? @"CountDownSec": @"CountDownSecs";
            NSString *secondUnit = [MVMCoreUIUtility hardcodedStringWithKey:secondKey];
            [timeString appendString:secondUnit];
        }
    }
    return timeString;
}

@end
