package com.miaxis.app.controller.lighting;

import com.miaxis.common.constant.Constants;
import com.miaxis.common.core.controller.BaseController;
import com.miaxis.common.core.domain.Response;
import com.miaxis.common.core.page.ResponsePageInfo;
import com.miaxis.lighting.domain.LightingCombination;
import com.miaxis.lighting.domain.LightingItem;
import com.miaxis.lighting.service.ILightingCombinationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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;

/**
 * 【灯光组合
】Controller
 *
 * @author miaxis
 * @date 2022-03-21
 */
@RestController
@RequestMapping(Constants.OPEN_PREFIX+"/lighting/combination")
@Api(tags={"【H5-灯光模拟】"})
public class LightingCombinationController extends BaseController{
    @Autowired
    private ILightingCombinationService lightingCombinationService;


    /**
     * 查询灯光组合列表
     */
    @GetMapping("/list")
    @ApiOperation("查询灯光组合列表")
    public ResponsePageInfo<LightingCombination> list(){
        List<LightingCombination> list = lightingCombinationService.selectLightingCombinationList(new LightingCombination());
        return toResponsePageInfo(list);
    }


    /**
     * 获取灯光组合
详细信息
     */
    @GetMapping(value = "/{id}")
    @ApiOperation("获取灯光组合中的单项列表")
    public Response<List<LightingItem>> getInfo(
            @ApiParam(name = "id", value = "灯光组合参数", required = true)
            @PathVariable("id") Long id
    ){
        return Response.success(lightingCombinationService.getLightingItemsById(id));
    }

}
