//
//  ThingsAddPlugViewController.m
//  kneet
//
//  Created by Jason Lee on 5/27/15.
//  Copyright (c) 2015 ntels. All rights reserved.
//

#import "ThingsAddPlugViewController.h"
#import "JDObject.h"
#import "QRCodeViewController.h"
#import "CustomLabel.h"
#import "CustomButton.h"


@interface ThingsAddPlugViewController () {

}
@end


#pragma mark - Class Definition

@implementation ThingsAddPlugViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    [self initUI];
    [self prepareViewDidLoad];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    self.title = NSLocalizedString(@"새 장치 추가",nil);
}

- (void)initUI {
    
    

    //set tableview option
    self.tableView.delegate = self;
    self.tableView.dataSource = self;

    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.backgroundColor = [UIColor clearColor];

    self.tableView.tableFooterView = [[UIView alloc] init]; //this call table events;
    
    //Localization
    _lblTitle.text = NSLocalizedString(@"DAWON 스마트플러그를 현재 홈에 등록합니다", @"DAWON 스마트플러그를 현재 홈에 등록합니다");
    
    _lblStep1Title.text = NSLocalizedString(@"다원플러그 app을 통해 플러그를 WIFI에 연결하세요", @"다원플러그 app을 통해 플러그를 WIFI에 연결하세요");
    _lblStep2Title.text = NSLocalizedString(@"WIFI에 연결된 플러그의  화면을 통해 AoTHome 등록 완료를 확인하세요", @"WIFI에 연결된 플러그의  화면을 통해 AoTHome 등록 완료를 확인하세요");
    _lblStep3Title.text= NSLocalizedString(@"플러그에 부착된 QR 코드를 촬영하세요", @"플러그에 부착된 QR 코드를 촬영하세요");
    
    [_btnQRCode setTitle:NSLocalizedString(@"QR코드 촬영", @"QR코드 촬영") forState:UIControlStateNormal];
}

- (void)prepareViewDidLoad {

}

#pragma mark - Main Logic



#pragma mark - UI Events
- (IBAction)btnDawonLinkTouched:(id)sender {
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:URL_DAWON_UPDATE]];
}

- (IBAction)btnQRCodeTouched:(id)sender {
    QRCodeViewController *vc = (QRCodeViewController *)[CommonUtil instantiateViewControllerWithIdentifier:@"QRCodeViewController" storyboardName:@"Things"];
//    vc.qrcodeType = QRCodeTypeDawonSmartPlug;
    [[JDFacade facade] presentViewControllerByPush:vc pvc:self];
}



#pragma mark - MemoryWarning
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
