//
//  HeadersH2CaretLink.swift
//  MVMCoreUI
//
//  Created by Lekshmi S on 01/07/20.
//  Copyright © 2020 Verizon Wireless. All rights reserved.
//

import Foundation
open class HeadersH2CaretLink: HeaderView {
    //--------------------------------------------------
    // MARK: - Outlets
    //--------------------------------------------------
    public let titleLockup = TitleLockup()
    public let caretLink = CaretLink()
    public lazy var stack: Stack<StackModel> = {
        return Stack<StackModel>.createStack(with: [titleLockup, caretLink])
      }()
    
    //-------------------------------------------------------
    // MARK: - Lifecycle
    //-------------------------------------------------------
    open override func setupView() {
        super.setupView()
        addMolecule(stack)
        stack.restack()
    }
    
    //----------------------------------------------------
    // MARK: - Molecule
    //------------------------------------------------------
    open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
        super.set(with: model, delegateObject, additionalData)
        guard let model = model as? HeadersH2CaretLinkModel else { return }
        titleLockup.set(with: model.titleLockup, delegateObject, additionalData)
        caretLink.set(with: model.caretLink, delegateObject, additionalData)
    }
    
    open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
        return 121
    }
}
