// https://github.com/search?q=repo%3Aqbittorrent%2FqBittorrent+path%3Asrc%2Fwebui%2Fapi%2Fserialize%2Fserialize_torrent.cpp+%2FQString+torrentStateToString%5C%28%2F&type=code
#[derive(Copy,Clone,Debug,serde::Deserialize,PartialEq,Eq,Hash,PartialOrd,Ord)]
#[serde(rename_all="kebab-case")]
pub enum TorrentState {
	#[serde(alias="checkingDL")] DownloadingChecking,
	#[serde(alias="checkingResumeData")] Resuming,
	#[serde(alias="checkingUP")] UploadingChecking,
	#[serde(alias="forcedDL")] DownloadingForced,
	#[serde(alias="forcedMetaDL")] DownloadingMetadataForced,
	#[serde(alias="forcedUP")] UploadingForced,
	#[serde(alias="metaDL")] DownloadingMetadata,
	#[serde(alias="missingFiles")] MissingFiles,
	#[serde(alias="queuedDL")] DownloadingQueued,
	#[serde(alias="queuedUP")] UploadingQueued,
	#[serde(alias="stalledDL")] DownloadingStalled,
	#[serde(alias="stalledUP")] UploadingStalled,
	#[serde(alias="stoppedDL")] StoppedDownloading,
	#[serde(alias="stoppedUP")] StoppedUploading,
	Downloading,
	Error,
	Moving,
	Uploading,
	#[serde(other)] Unknown
}

impl TorrentState {
	pub fn is_downloading_metadata(&self) -> bool {
		match self {
			TorrentState::DownloadingMetadata => true,
			TorrentState::DownloadingMetadataForced => true,
			_ => false,
		}
	}
}
