//
//  Global.h
//  RealEstateManagement
//
//  Created by Javen on 2017/2/23.
//  Copyright © 2017年 上海勾芒信息科技. All rights reserved.
//
#ifndef Global_h
#define Global_h
#import <UIKit/UIKit.h>

#define kWindow [UIApplication sharedApplication].keyWindow
#define kBounds [UIScreen mainScreen].bounds
#define kWidth [UIScreen mainScreen].bounds.size.width
#define kHeight [UIScreen mainScreen].bounds.size.height
#define kAutoValue(value) (float) value / 375 * kWidth
#define WS(weakSelf) __weak __typeof(&*self) weakSelf = self
#define kPlaceHolderImage [UIImage imageNamed:@"PlaceHolder_image"]

#define IBT_IOS7_OR_LATER ([[[UIDevice currentDevice] systemVersion] compare:@"7.0"] != NSOrderedAscending)

// 判断是否请求成功
#define kIsResponse [responseObject[@"message"] isEqualToString:@"ok"] && responseObject != nil
#define IsNotNullObject(Object) ![(Object) isKindOfClass:[NSNull class]]
#define SAFE_STRING(string) [string isKindOfClass:[NSString class]] && string.length > 0 ? string : @""
#define kNotNullContent(string) [string isKindOfClass:[NSString class]] && string.length > 0 ? string : @"暂无"
#define kDecimalString(string) [NSString stringWithFormat:@"%.2f", string]

//收起键盘
#define HIDE_KEYBOARD [[UIApplication sharedApplication].keyWindow endEditing:YES]

#ifdef DEBUG
#define CLog(format, ...) printf("class: <%p %s:(%d) > method: %s \n%s\n", self, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, __PRETTY_FUNCTION__, [[NSString stringWithFormat:(format), ##__VA_ARGS__] UTF8String])
#else
#define CLog(format, ...)
#endif

#define ZJLazy(_type_, _ivar_)                 \
    -(_type_ *) _ivar_ {                       \
        if (!_##_ivar_) {                      \
            _##_ivar_ = [[_type_ alloc] init]; \
        }                                      \
        return _##_ivar_;                      \
    }
#define ZJNSNumberString(string) string.length > 0 ? [NSDecimalNumber decimalNumberWithString:string] : nil;

/**
 *  colors
 */
#define kSysWhite [UIColor whiteColor]
//红 #ED1B23
#define kMainRedColor [UIColor colorWithRed:0.929 green:0.106 blue:0.137 alpha:1.000]
//蓝 #478FF1
#define kMainBlueColor [UIColor colorWithRed:0.278 green:0.561 blue:0.945 alpha:1.000]
//橙 #EA6402
#define kMainOrangeColor [UIColor colorWithRed:1.000 green:0.498 blue:0.000 alpha:1.000]
//紫 #5435AD
#define kMainPurpleColor [UIColor colorWithRed:0.329 green:0.208 blue:0.678 alpha:1.000]
//黑
#define kMainBlackColor [UIColor colorWithRed:0.13 green:0.15 blue:0.17 alpha:1.00]

#define kMainColor kMainBlueColor
#endif /* Global_h */
