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

import Foundation

enum MusicLibraryOptions: Int {
	case playNow = 0
	case playNext
	case addToQueue
	case clearFavorites
	case editPlaylistName
	case clearPlaylist
	case deletePlaylist
	
	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 .clearFavorites: return NSLocalizedString("Clear Favorites", comment: "Option")
		case .editPlaylistName: return NSLocalizedString("Edit Playlist Name", comment: "Option")
		case .clearPlaylist: return NSLocalizedString("Clear Playlist", comment: "Option")
		case .deletePlaylist: return NSLocalizedString("Delete Playlist", comment: "Option")
		}
	}
	
	static func from(string: String) -> MusicLibraryOptions? {
		if string == MusicLibraryOptions.playNow.toString() {
			return MusicLibraryOptions.playNow
		}
		if string == MusicLibraryOptions.playNext.toString() {
			return MusicLibraryOptions.playNext
		}
		if string == MusicLibraryOptions.addToQueue.toString() {
			return MusicLibraryOptions.addToQueue
		}
		if string == MusicLibraryOptions.clearFavorites.toString() {
			return MusicLibraryOptions.clearFavorites
		}
		if string == MusicLibraryOptions.editPlaylistName.toString() {
			return MusicLibraryOptions.editPlaylistName
		}
		if string == MusicLibraryOptions.clearPlaylist.toString() {
			return MusicLibraryOptions.clearPlaylist
		}
		if string == MusicLibraryOptions.deletePlaylist.toString() {
			return MusicLibraryOptions.deletePlaylist
		}
		return nil
	}
}
