spotify_cli/domain/
search.rs

1use serde::{Deserialize, Serialize};
2
3/// Search result kinds supported by Spotify search.
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5pub enum SearchType {
6    All,
7    Track,
8    Album,
9    Artist,
10    Playlist,
11}
12
13/// Normalized search item across Spotify result types.
14#[derive(Debug, Clone, Serialize, Deserialize)]
15pub struct SearchItem {
16    pub id: String,
17    pub name: String,
18    pub uri: String,
19    /// Item kind for mixed searches.
20    pub kind: SearchType,
21    /// Artist names for track/album results.
22    pub artists: Vec<String>,
23    /// Owner display name for playlist results.
24    pub owner: Option<String>,
25    /// Optional fuzzy score, 0.0..=1.0.
26    pub score: Option<f32>,
27}
28
29/// Aggregated search results with a kind discriminator.
30#[derive(Debug, Clone, Serialize, Deserialize)]
31pub struct SearchResults {
32    pub kind: SearchType,
33    pub items: Vec<SearchItem>,
34}