package com.playlet.web.controller.app;

import com.github.pagehelper.PageInfo;
import com.playlet.common.core.controller.BaseController;
import com.playlet.common.core.domain.Result;
import com.playlet.system.domain.PlayletItemType;
import com.playlet.web.service.app.PlayletItemTypeAppService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@Api(tags = "短剧视频*剧场列表")
@RestController
@RequestMapping(value = "/app/type")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class PlayletItemTypeAppController extends BaseController {

    private final PlayletItemTypeAppService playletItemTypeAppService;

    /**
     * 查询剧场分页列表
     */
    @ResponseBody
    @PostMapping("/getTypePage")
    @ApiOperation(value = "分页查询剧场列表")
    public Result<PageInfo<PlayletItemType>> getTypePage(@RequestBody PlayletItemType playletItemType,
                                                     @RequestParam(value = "pageNum")Integer pageNum,
                                                     @RequestParam(value = "pageSize")Integer pageSize) {
        return Result.success(playletItemTypeAppService.getTypePage(playletItemType, pageNum, pageSize));
    }

    /**
     * 查询剧场不分页列表
     */
    @ResponseBody
    @PostMapping("/getTypeList")
    @ApiOperation(value = "不分页查询剧场列表")
    public Result<List<PlayletItemType>> getTypeList(@RequestBody PlayletItemType playletItemType) {
        return Result.success(playletItemTypeAppService.getTypeList(playletItemType));
    }

}
