//
//  ThingsDelValveViewController.m
//  OneCable
//
//  Created by nComz on 2017. 3. 21..
//  Copyright © 2017년 ntels. All rights reserved.
//

#import "ThingsGeneralDelViewController.h"
#import "CustomLabel.h"
#import "CustomButton.h"
#import "CustomImageView.h"

#import "ThingsGeneralDelStartViewController.h"

@interface ThingsGeneralDelViewController ()

@end

@implementation ThingsGeneralDelViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self initUI];
    [self prepareViewDidLoad];
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [UIView animateWithDuration:kfAnimationDur animations:^{
        _maskView.alpha = 0.7;
    } completion:^(BOOL finished) {
        
        
        [UIView animateWithDuration:kfAnimationDur animations:^{
            [self.view layoutIfNeeded];
        }];
    }];
}

- (void)initUI {
    //    [self initTableViewAsDefaultStyle:_tableView];
//    [self startLoading:NO];
}

- (void)prepareViewDidLoad {
    //    [self startLoading:NO];
    _imgThings.image = [_delDevice imgaeForAddDel];
    _lblManufacturer.text = [_delDevice manufacturerName];
    _lblTitle.text = [NSString stringWithFormat:@"%@ 삭제", _delDevice.prdName];
}



- (IBAction)btnCancelTouched:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (IBAction)btnStartTouched:(id)sender {

    if (![[JDFacade facade].loginUser onlineHomeHubFromSelectedHub:_delDevice]) {
        
        [[JDFacade facade] alert:@"허브가 오프라인 상태입니다. 허브 상태 확인 후 다시 시도해주세요." completionHander:^{
            
            [self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
            
        }];
        
        return;
    }
    
    ThingsGeneralDelStartViewController *vc = [CommonUtil instantiateViewControllerWithIdentifier:@"ThingsGeneralDelStartViewController" storyboardName:@"Things"];
    
    vc.delDevice = _delDevice;
    
    [self showTransparencyModalView:vc];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}

@end
