//
//  DiscoveryType.m
//  AliLiving
//
//  Created by Li Zheng on 2021/3/25.
//

#import "DiscoveryType.h"

@implementation DiscoveryType

+ (NSInteger)getType:(NSString *)devType {
    if ([devType isEqual:@"ble_subtype_3"]) {
        return DISCOVERY_COMBO_SUBTYPE_0X03_DEVICE;
    }
    if ([devType isEqual:@"0"]) {
        return DISCOVERY_LOCAL_ONLINE_DEVICE;
    }
    if ([devType isEqual:@"ble_subtype_4"]) {
        return DISCOVERY_COMBO_SUBTYPE_0X04_DEVICE;
    }
    if ([devType isEqual:@"wifi"]) {
        return DISCOVERY_CLOUD_ENROLLEE_DEVICE;
    }
    if ([devType isEqual:@"breeze"]) {
        return DISCOVERY_BLE_ENROLLEE_DEVICE;
    }
    if ([devType isEqual:@"third"]) {
        return DISCOVERY_SOFT_AP_DEVICE;
    }

    // TODO: other isEqual, PR is welcome

    return DISCOVERY_COMBO_SUBTYPE_0X03_DEVICE;
};

+ (NSString *)getValue:(NSInteger)type {
    switch (type) {
        case DISCOVERY_LOCAL_ONLINE_DEVICE:
            return @"LOCAL_ONLINE_DEVICE";
            break;
        case DISCOVERY_CLOUD_ENROLLEE_DEVICE:
            return @"CLOUD_ENROLLEE_DEVICE";
            break;
        case DISCOVERY_BLE_ENROLLEE_DEVICE:
            return @"BLE_ENROLLEE_DEVICE";
            break;
        case DISCOVERY_SOFT_AP_DEVICE:
            return @"SOFT_AP_DEVICE";
            break;
        case DISCOVERY_BEACON_DEVICE:
            return @"BEACON_DEVICE";
            break;
        case DISCOVERY_COMBO_SUBTYPE_0X03_DEVICE:
            return @"COMBO_SUBTYPE_0X03_DEVICE";
            break;
        case DISCOVERY_COMBO_SUBTYPE_0X04_DEVICE:
            return @"COMBO_SUBTYPE_0X04_DEVICE";
            break;
        case DISCOVERY_APP_FOUND_BLE_MESH_DEVICE:
            return @"APP_FOUND_BLE_MESH_DEVICE";
            break;
        case DISCOVERY_CLOUD_BLE_MESH_DEVICE:
            return @"CLOUD_BLE_MESH_DEVICE";
            break;

        default:
            return @"COMBO_SUBTYPE_0X03_DEVICE";
            break;
    }
};

@end
