package com.playlet.web.controller.app;

import com.github.pagehelper.PageInfo;
import com.playlet.common.core.domain.Result;
import com.playlet.system.domain.PlayletUserExpandAccount;
import com.playlet.web.service.app.PlayletExpandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>短剧*扩展账号管理</p>
 * @author clunt
 */
@Api(tags = "短剧*扩展账号管理")
@RestController
@RequestMapping(value = "/app/expand")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class PlayletExpandAppController {

    private final PlayletExpandService playletExpandService;

    @ResponseBody
    @PostMapping("/getPageList")
    @ApiOperation(value = "分页查询短剧扩展账号列表")
    public Result<PageInfo<PlayletUserExpandAccount>> getPageList(@RequestBody PlayletUserExpandAccount expandAccount,
                                                                  @RequestParam(value = "pageNum")Integer pageNum,
                                                                  @RequestParam(value = "pageSize")Integer pageSize) {
        return Result.success(playletExpandService.getPageList(expandAccount, pageNum, pageSize));
    }

    @ResponseBody
    @PostMapping("/getList")
    @ApiOperation(value = "查询短剧扩展账号列表")
    public Result<List<PlayletUserExpandAccount>> getList(@RequestBody PlayletUserExpandAccount expandAccount) {
        return Result.success(playletExpandService.getList(expandAccount));
    }

    @ResponseBody
    @PostMapping("/addAccount")
    @ApiOperation(value = "新增扩展账号")
    public Result<String> addAccount(@RequestBody PlayletUserExpandAccount expandAccount) {
        playletExpandService.addAccount(expandAccount);
        return Result.success();
    }

}
