1
use serde::{Deserialize, Serialize};
2

            
3
use crate::{
4
    commands::{Command, CommandResponse, ResponseParserError, single_item_command_request},
5
    response_tokenizer::ResponseAttributes,
6
    types::{DbSongInfo, Priority, SongId, SongPosition},
7
};
8

            
9
pub struct PlaylistId;
10

            
11
single_item_command_request!(PlaylistId, "playlistid", SongId);
12

            
13
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14
pub struct PlaylistIdResponse(Vec<PlaylistIdResponseEntry>);
15

            
16
impl PlaylistIdResponse {
17
    pub fn new(items: Vec<PlaylistIdResponseEntry>) -> Self {
18
        PlaylistIdResponse(items)
19
    }
20
}
21

            
22
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
23
pub struct PlaylistIdResponseEntry {
24
    pub position: SongPosition,
25
    pub id: SongId,
26
    pub priority: Option<Priority>,
27
    pub song_info: DbSongInfo,
28
}
29

            
30
impl PlaylistIdResponseEntry {
31
    pub fn new(
32
        position: SongPosition,
33
        id: SongId,
34
        priority: Option<Priority>,
35
        song_info: DbSongInfo,
36
    ) -> Self {
37
        PlaylistIdResponseEntry {
38
            position,
39
            id,
40
            priority,
41
            song_info,
42
        }
43
    }
44
}
45

            
46
impl CommandResponse for PlaylistIdResponse {
47
    fn parse(_parts: ResponseAttributes<'_>) -> Result<Self, ResponseParserError> {
48
        unimplemented!()
49
    }
50
}
51

            
52
impl Command for PlaylistId {
53
    type Request = PlaylistIdRequest;
54
    type Response = PlaylistIdResponse;
55
}