//
//  UIBackgroundConfiguration+AppColors.swift
//  Tusker
//
//  Created by Shadowfacts on 4/16/23.
//  Copyright © 2023 Shadowfacts. All rights reserved.
//

import UIKit

extension UIBackgroundConfiguration {
    static func appListPlainCell(for state: UICellConfigurationState) -> UIBackgroundConfiguration {
        var config = UIBackgroundConfiguration.listPlainCell().updated(for: state)
        if state.isFocused {
            // use default
        } else if state.isHighlighted || state.isSelected {
            config.backgroundColor = .appSelectedCellBackground
        } else {
            config.backgroundColor = .appBackground
        }
        return config
    }
    
    static func appListGroupedCell(for state: UICellConfigurationState) -> UIBackgroundConfiguration {
        var config = UIBackgroundConfiguration.listGroupedCell().updated(for: state)
        if state.isFocused {
            // use default
        } else if state.isHighlighted || state.isSelected {
            config.backgroundColor = .appSelectedCellBackground
        } else {
            config.backgroundColor = .appGroupedCellBackground
        }
        return config
    }
}
