//
//  MoreBtnModel.m
//  OneCable
//
//  Created by KaRam Kim on 2017. 3. 15..
//  Copyright © 2017년 ntels. All rights reserved.
//

#import "MoreBtnModel.h"

@implementation MoreBtnModel

-(id)init
{
    if (self = [super init]) {
        _show = YES;
    }
    return self;
}

-(id)initWithTyep:(MoreBtnType)type isEnable:(BOOL)isEnabel
{
    self = [self init];
    
    [self setBtnType:type isEnable:isEnabel];
    
    return self;
}

-(void)setBtnType:(MoreBtnType)type isEnable:(BOOL)isEnabel
{
    _btnType = type;
    switch (type) {
        case MasterTransfer:
            [self setBtnImage:UIControlStateNormal imgName:@"img_bg_morepopup_icon_masterchange"];
            [self setBtnImage:UIControlStateHighlighted imgName:@"img_bg_morepopup_icon_masterchange_press"];
            break;
        case ReOrder:
            [self setBtnImage:UIControlStateNormal imgName:@"img_bg_morepopup_icon_thingschange"];
            [self setBtnImage:UIControlStateHighlighted imgName:@"img_bg_morepopup_icon_thingschange_press"];
            break;
        case AddMember:
            [self setBtnImage:UIControlStateNormal imgName:@"img_bg_morepopup_memberadd"];
            [self setBtnImage:UIControlStateHighlighted imgName:@"img_bg_morepopup_memberadd_press"];
            break;
        case Add:
            [self setBtnImage:UIControlStateNormal imgName:@"img_bg_morepopup_icon_add"];
            [self setBtnImage:UIControlStateHighlighted imgName:@"img_bg_morepopup_icon_add_press"];
            break;
        case NameChange:
            [self setBtnImage:UIControlStateNormal imgName:@"img_bg_morepopup_icon_name"];
            [self setBtnImage:UIControlStateHighlighted imgName:@"img_bg_morepopup_icon_name_press"];
            break;
        case Del:
            [self setBtnImage:UIControlStateNormal imgName:@"img_bg_morepopup_icon_delete"];
            [self setBtnImage:UIControlStateHighlighted imgName:@"img_bg_morepopup_icon_delete_press"];
            break;
        case Refresh:
            [self setBtnImage:UIControlStateNormal imgName:@"img_bg_morepopup_icon_refresh"];
            [self setBtnImage:UIControlStateHighlighted imgName:@"img_bg_morepopup_icon_refresh_press"];
            break;
    }
    _enable = isEnabel;
}


-(void)setBtnImage:(UIControlState)state imgName:(NSString *)name
{
    switch (state)
    {
        case UIControlStateNormal:
            _imgNormal = [UIImage imageNamed:name];
            break;
        case UIControlStateHighlighted:
            _imgHighlight = [UIImage imageNamed:name];
            break;
        case UIControlStateDisabled:
            _imgDisabled = [UIImage imageNamed:name];
            break;
            
        default:
            break;
    }
}


- (UIImage *)getBtnImg:(UIControlState)state
{
    switch (state)
    {
        case UIControlStateNormal:
            return _imgNormal;
            break;
        case UIControlStateHighlighted:
            return _imgHighlight;
            break;
        case UIControlStateDisabled:
            return _imgDisabled;
            break;
            
        default:
            break;
    }
    return nil;
}

- (BOOL)isEnable
{
    return _enable;
}

- (BOOL)isShow
{
    return _show;
}

@end
