//
//  RadioBoxCollectionViewCell.swift
//  MVMCoreUI
//
//  Created by Dhamodaram Nandi on 01/04/20.
//  Copyright © 2020 Verizon Wireless. All rights reserved.
//

open class RadioBoxCollectionViewCell: CollectionViewCell {
    //--------------------------------------------------
    // MARK: - Outlets
    //--------------------------------------------------
    
    public let radioBox = RadioBox()
    
    //--------------------------------------------------
    // MARK: - Lifecycle
    //--------------------------------------------------
    
    open override func reset() {
        super.reset()
        backgroundColor = .clear
    }
    
    open override func setupView() {
        super.setupView()
        isAccessibilityElement = true
        addMolecule(radioBox)
        MVMCoreUIUtility.setMarginsFor(contentView, leading: 0, top: 0, trailing: 0, bottom: 0)
    }
    
    open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
        guard let model = model as? RadioBoxModel else { return }
        radioBox.set(with: model, delegateObject, additionalData)
        updateAccessibility()
    }
    
    open func updateAccessibility() {
        accessibilityLabel = radioBox.accessibilityLabel
        accessibilityHint = radioBox.accessibilityHint
        accessibilityTraits = radioBox.accessibilityTraits
    }
}
