//
//  ContentPlaylistListRepository.swift
//  SodaLive
//
//  Created by klaus on 12/7/24.
//

import CombineMoya
import Combine
import Moya

class ContentPlaylistListRepository {
    private let api = MoyaProvider<PlaylistApi>()
    
    func getPlaylistList() -> AnyPublisher<Response, MoyaError> {
        return api.requestPublisher(.getPlaylistList)
    }
    
    func createPlaylist(request: CreatePlaylistRequest) -> AnyPublisher<Response, MoyaError> {
        return api.requestPublisher(.createPlaylist(request: request))
    }
    
    func getPlaylistDetail(playlistId: Int) -> AnyPublisher<Response, MoyaError> {
        return api.requestPublisher(.getPlaylistDetail(playlistId: playlistId))
    }
    
    func deletePlaylist(playlistId: Int) -> AnyPublisher<Response, MoyaError> {
        return api.requestPublisher(.deletePlaylist(playlistId: playlistId))
    }
    
    func updatePlaylist(playlistId: Int, request: UpdatePlaylistRequest) -> AnyPublisher<Response, MoyaError> {
        return api.requestPublisher(.updatePlaylist(playlistId: playlistId, request: request))
    }
}
