//
//  LoadingSpinner.swift
//  MVMCoreUI
//
//  Created by Kevin Christiano on 5/20/20.
//  Copyright © 2020 Verizon Wireless. All rights reserved.
//

import UIKit
import VDS

open class LoadingSpinner: VDS.Loader, VDSMoleculeViewProtocol {
    
    //--------------------------------------------------
    // MARK: - Public Properties
    //--------------------------------------------------
    open var viewModel: LoadingSpinnerModel!
    open var delegateObject: MVMCoreUIDelegateObject?
    open var additionalData: [AnyHashable : Any]?
    
    //--------------------------------------------------
    // MARK: - Public Functions
    //--------------------------------------------------
    open func viewModelDidUpdate() {
        size = Int(viewModel.diameter)
        surface = viewModel.surface
    }
    
    //--------------------------------------------------
    // MARK: - MVMCoreViewProtocol
    //--------------------------------------------------
    open class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject:  MVMCoreUIDelegateObject?) -> CGFloat? {
        guard let model = model as? LoadingSpinnerModel else { return 0 }
        return model.diameter
    }

    open func updateView(_ size: CGFloat) { }

}
