//
// © 2017-2020 Qualcomm Technologies, Inc. and/or its subsidiaries. All rights reserved.
//

import UIKit

enum MusicLibraryItemOptions: Int {
	case playNow = 0
	case playNext
	case addToQueue
	case addToFavorites
	case removeFromFavorites
	case addToPlaylist
	case removeFromPlaylist
	case removeFromQueue
	
	func toString() -> String {
		switch self {
		case .playNow: return NSLocalizedString("Play Now", comment: "Option")
		case .playNext: return NSLocalizedString("Play Next", comment: "Option")
		case .addToQueue: return NSLocalizedString("Add to Queue", comment: "Option")
		case .addToFavorites: return NSLocalizedString("Add to Favorites", comment: "Option")
		case .removeFromFavorites: return NSLocalizedString("Remove from Favorites", comment: "Option")
		case .addToPlaylist: return NSLocalizedString("Add to a Playlist", comment: "Option")
		case .removeFromPlaylist: return NSLocalizedString("Remove from Playlist", comment: "Option")
		case .removeFromQueue: return NSLocalizedString("Remove from Queue", comment: "Option")
		}
	}
	
	static func from(string: String) -> MusicLibraryItemOptions? {
		if string == MusicLibraryItemOptions.playNow.toString() {
			return MusicLibraryItemOptions.playNow
		}
		if string == MusicLibraryItemOptions.playNext.toString() {
			return MusicLibraryItemOptions.playNext
		}
		if string == MusicLibraryItemOptions.addToQueue.toString() {
			return MusicLibraryItemOptions.addToQueue
		}
		if string == MusicLibraryItemOptions.addToFavorites.toString() {
			return MusicLibraryItemOptions.addToFavorites
		}
		if string == MusicLibraryItemOptions.removeFromFavorites.toString() {
			return MusicLibraryItemOptions.removeFromFavorites
		}
		if string == MusicLibraryItemOptions.addToPlaylist.toString() {
			return MusicLibraryItemOptions.addToPlaylist
		}
		if string == MusicLibraryItemOptions.removeFromPlaylist.toString() {
			return MusicLibraryItemOptions.removeFromPlaylist
		}
		if string == MusicLibraryItemOptions.removeFromQueue.toString() {
			return MusicLibraryItemOptions.removeFromQueue
		}
		return nil
	}
}
