//
//  MoleculeListCellProtocol.swift
//  MVMCoreUI
//
//  Created by Scott Pfeil on 1/10/20.
//  Copyright © 2020 Verizon Wireless. All rights reserved.
//


public protocol MoleculeListCellProtocol: UITableViewCell {
    /// Can set the separator according to what the moleculeList commands.
    func setLines(with model: LineModel?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?, indexPath: IndexPath)
    
    /// Handle action when cell is pressed
    func willSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> Bool
    
    /// Handle action when cell is pressed
    func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?)
    
    /// Handle action when cell is deselected.
    func didDeselectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?)
    
    /// Called by the list when the cell will display.
    func willDisplay()
}

// Default implementation does nothing
public extension MoleculeListCellProtocol {
    
    func setLines(with model: LineModel?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?, indexPath: IndexPath) { }
    
    func willSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> Bool { true }
    
    func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { }
    
    func didDeselectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { }
    
    func willDisplay() { }
}
