package com.liquidnet.service.kylin.controller;

import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.dto.vo.returns.KylinArtistDetailFrontVo;
import com.liquidnet.service.kylin.dto.vo.returns.KylinArtistPerformanceFrontVo;
import com.liquidnet.service.kylin.dto.vo.returns.KylinArtistProductFrontVo;
import com.liquidnet.service.kylin.service.IKylinArtistFrontService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "前端-艺人")
@RestController
@RequestMapping("artist")
@Slf4j
public class KylinArtistController {

    @Autowired
    private IKylinArtistFrontService kylinArtistFrontService;

    @GetMapping("detail/{artistId}")
    @ApiOperation("艺人详情（简介）")
    @ApiImplicitParam(type = "path", dataType = "String", name = "artistId", value = "艺人ID", required = true)
    public ResponseDto<KylinArtistDetailFrontVo> detail(@PathVariable String artistId) {
        KylinArtistDetailFrontVo vo = kylinArtistFrontService.getArtistDetail(artistId);
        if (vo == null) {
            return ResponseDto.failure("艺人不存在");
        }
        return ResponseDto.success(vo);
    }

    @GetMapping("{artistId}/album")
    @ApiOperation("艺人相册")
    @ApiImplicitParam(type = "path", dataType = "String", name = "artistId", value = "艺人ID", required = true)
    public ResponseDto<List<String>> album(@PathVariable String artistId) {
        return ResponseDto.success(kylinArtistFrontService.getArtistAlbum(artistId));
    }

    @GetMapping("{artistId}/performances")
    @ApiOperation("艺人关联演出（未开售/已开售，不含已结束）")
    @ApiImplicitParam(type = "path", dataType = "String", name = "artistId", value = "艺人ID", required = true)
    public ResponseDto<List<KylinArtistPerformanceFrontVo>> performances(@PathVariable String artistId) {
        return ResponseDto.success(kylinArtistFrontService.getArtistPerformances(artistId));
    }

    @GetMapping("{artistId}/products")
    @ApiOperation("艺人关联商品")
    @ApiImplicitParam(type = "path", dataType = "String", name = "artistId", value = "艺人ID", required = true)
    public ResponseDto<List<KylinArtistProductFrontVo>> products(@PathVariable String artistId) {
        return ResponseDto.success(kylinArtistFrontService.getArtistProducts(artistId));
    }
}
