//
//  Tag.swift
//  MVMCoreUI
//
//  Created by Dhamodaram Nandi on 29/05/20.
//  Copyright © 2020 Verizon Wireless. All rights reserved.
//

import Foundation


@objcMembers open class Tag: View {
    //--------------------------------------------------
    // MARK: - Outlets
    //--------------------------------------------------
    
    public let label = Label(fontStyle: .RegularBodySmall)
    
    //--------------------------------------------------
    // MARK: - MVMCoreViewProtocol
    //--------------------------------------------------
    
    open override func setupView() {
        super.setupView()
        layer.borderColor = UIColor.mvmCoolGray6.cgColor
        layer.borderWidth = 1
        addSubview(label)
        NSLayoutConstraint.constraintPinSubview(label, pinTop: true, topConstant: 13, pinBottom: true, bottomConstant: 13, pinLeft: true, leftConstant: 15, pinRight: true, rightConstant: 15)
    }
    
    open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
        
        guard let model = model as? TagModel else { return }
        
        label.set(with: model.label, delegateObject, additionalData)
    }
    
    @objc override open func updateView(_ size: CGFloat) {
        super.updateView(size)
        label.updateView(size)
    }
    
    open override func reset() {
        super.reset()
        label.reset()
        label.setFontStyle(.RegularBodySmall)
    }
}
