//
//  YMIMHintView.m
//  PCDBank
//
//  Created by Gusont on 2021/8/26.
//  Copyright © 2021 SLAiELTS. All rights reserved.
//

#import "YMIMHintView.h"
//#import "UIView+YMHelper.h"

@interface YMIMHintView()

@property (nonatomic, strong) UIImageView *serviceHeadImageView;

@property (nonatomic, strong) UIView *hintTextBgView;

@end

@implementation YMIMHintView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self confignUI];
    }
    return self;
}

- (void)confignUI
{
    [self.serviceHeadImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.width.height.mas_equalTo(36);
        make.top.mas_equalTo(16);
    }];
    
    [self.hintTextBgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.serviceHeadImageView.mas_bottom).offset(16);
        make.centerX.equalTo(self);
        make.height.mas_equalTo(100 * KScaleW);
        make.left.mas_equalTo(16 * KScaleW);
    }];
    
    [self.hintTextLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.hintTextBgView);
        make.top.left.mas_equalTo(13 * KScaleW);
    }];
    
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectZero];
    imageView.image = ImageName(@"icon3_service_horn");
    [self addSubview:imageView];
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.hintTextBgView);
        make.bottom.equalTo(self.hintTextBgView.mas_top).offset(1);
    }];
}
//
//- (void)drawRect:(CGRect)rect
//{
//    [self.hintTextBgView addShadowWithBezierPath];
//}

- (UILabel *)hintTextLabel
{
    if (!_hintTextLabel) {
        _hintTextLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        _hintTextLabel.text = @"您好！我是智能助手小裕！请问有什么能帮您？";
        _hintTextLabel.textAlignment = NSTextAlignmentCenter;
//        _hintTextLabel.textColor = YMTitleColor;
        _hintTextLabel.font = [UIFont systemFontOfSize:22];
        _hintTextLabel.numberOfLines = 0;
        [self.hintTextBgView addSubview:_hintTextLabel];
    }
    return _hintTextLabel;
}

- (UIView *)hintTextBgView
{
    if (!_hintTextBgView) {
        _hintTextBgView = [[UIView alloc] initWithFrame:CGRectZero];
        _hintTextBgView.backgroundColor = [UIColor whiteColor];
        [self addSubview:_hintTextBgView];
    }
    return _hintTextBgView;
}

- (UIImageView *)serviceHeadImageView
{
    if (!_serviceHeadImageView) {
        _serviceHeadImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
        _serviceHeadImageView.image = ImageName(@"icon3_service_head");
        [self addSubview:_serviceHeadImageView];
    }
    return _serviceHeadImageView;
}

@end
