//
//  MFLoadingSpinner.m
//  mobilefirst
//
//  Created by Wesolowski, Brendan on 3/10/16.
//  Copyright © 2016 Verizon Wireless. All rights reserved.
//

#import "MFLoadingSpinner.h"
#import <VDS/VDS.h>
#import <MVMCoreUI/MVMCoreUI-Swift.h>

@interface MFLoadingSpinner ()
@property (strong, nonatomic) VDSLoader *loader;
@end

@implementation MFLoadingSpinner

- (instancetype)init {
    self = [super init];
    if (self) {
        [self setup];
    }
    return self;
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setup];
    }
    return self;
}

- (instancetype)initWithCoder:(NSCoder *)coder {
    self = [super initWithCoder: coder];
    if (self) {
        [self setup];
    }
    return self;
}

-(void) setup {
    if (self.loader) { return; }
    self.loader = [[VDSLoader alloc] init];
    [self addSubview: self.loader];
    [NSLayoutConstraint pinViewToSuperview:self.loader useMargins:false];
}

-(void)setUpCircle {
    [self setSurface: UIColor.blackColor];
}

-(void)setUpCircle:(nullable UIColor *)strokeColor {
    [self setSurface: strokeColor];
}

-(void)changeColor:(nullable UIColor *)strokeColor {
    [self setSurface: strokeColor];
}

- (void)pauseSpinner {
    [self pause];
}

- (void)resumeSpinner {
    [self resume];
}

// Starts the spinner after a slight delay.
- (void)resumeSpinnerAfterDelay {
    [self resumeAfterDelay];
}

- (nullable NSDictionary *)pinWidthAndHeight {
    return [self pin];
}
@end
