package com.qiuguo.iot.user.api.controller;

import com.alibaba.fastjson.JSONArray;
import com.qiuguo.iot.third.resp.SongInfoResponse;
import com.qiuguo.iot.third.service.MusicService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

/**
 * XXX
 *
 * @author weiyachao
 * @since 2023/9/28 12:28
 */
@RestController
@RequestMapping("/music")
public class MusicController {
    
    @Autowired
    private MusicService musicService;
    
    @GetMapping("/search")
    public Mono<List<SongInfoResponse.ResultSong>> search(String name,
            @RequestParam(required = false, defaultValue = "1") Integer type) {
        return musicService.searchMusic(name,type);
    }


}
