//
//  HeadersH2Link.swift
//  MVMCoreUI
//
//  Created by Lekshmi S on 24/06/20.
//  Copyright © 2020 Verizon Wireless. All rights reserved.
//

import Foundation

open class HeadersH2Link: HeaderView {
    //--------------------------------------------------
    // MARK: - Outlets
    //--------------------------------------------------
    public let titleLockup = TitleLockup()
    public let link = Link()
    public lazy var stack: Stack<StackModel> = {
        return Stack<StackModel>.createStack(with: [titleLockup, link])
      }()
    
    //-------------------------------------------------------
    // 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? HeadersH2LinkModel else { return }
        titleLockup.set(with: model.titleLockup, delegateObject, additionalData)
        link.set(with: model.link, delegateObject, additionalData)
    }
    
    open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
        return 121
    }
}
