//
//  SettingsPresenter.swift
//  freeza
//
//  Created by Cesar Brenes on 12/17/20.
//  Copyright (c) 2020 Zerously. All rights reserved.
//
//  This file was generated by the Clean Swift Xcode Templates so
//  you can apply clean architecture to your iOS and Mac projects,
//  see http://clean-swift.com
//

import UIKit

protocol SettingsPresentationLogic {
    func presentDataSource(response: Settings.DataSource.Response)
}

class SettingsPresenter: SettingsPresentationLogic {
    weak var viewController: SettingsDisplayLogic?
    
    func presentDataSource(response: Settings.DataSource.Response) {
        let items = response.items.map({Settings.ItemToDisplay(title: getTitleName(type: $0.type), value: $0.value)})
        viewController?.displayDataSource(viewModel: Settings.DataSource.ViewModel(items: items))
    }
    
    private func getTitleName(type: Settings.Option) -> String {
        switch type {
        case .safe:
            return Localized.Strings.allowNsfwContent.rawValue
        }
    }
}
