package com.ruixuan.launch.controller;

import com.alibaba.fastjson.JSONObject;
import com.ruixuan.common.core.controller.BaseController;
import com.ruixuan.common.core.domain.AjaxResult;
import com.ruixuan.common.core.domain.ResultResponse;
import com.ruixuan.common.core.page.TableDataInfo;
import com.ruixuan.launch.entity.KuaishouLaunchGroupTarget;
import com.ruixuan.launch.service.IKuaishouLaunchGroupTargetService;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 广告组定向信息Controller
 *
 * @author ruoyi
 * @date 2022-06-28
 */
@Api(tags = "定向信息")
@RestController
@RequestMapping("/launch/target")
public class KuaishouLaunchGroupTargetController extends BaseController {
    @Autowired
    private IKuaishouLaunchGroupTargetService kuaishouLaunchGroupTargetService;

    /**
     * 查询广告组定向信息列表
     */
    @GetMapping("/list")
    public TableDataInfo list(KuaishouLaunchGroupTarget kuaishouLaunchGroupTarget) {
        startPage();
        List<KuaishouLaunchGroupTarget> list = kuaishouLaunchGroupTargetService.selectKuaishouLaunchGroupTargetList(kuaishouLaunchGroupTarget);
        return getDataTable(list);
    }


    /**
     * 获取地域信息
     */
    @PostMapping(value = "/getRegion")
    @ApiOperation(value = "获取地域信息")
    public ResultResponse getRegion(@ApiParam("账户id") @RequestParam(value = "accountId", required = true) Long accountId,
                                    @ApiParam("类别") @RequestParam(value = "categoryType", required = true) Integer categoryType) {
        return kuaishouLaunchGroupTargetService.getRegion(accountId, categoryType);
    }

    /**
     * 获取人群列表
     */
    @PostMapping(value = "/getPopulation")
    @ApiOperation(value = "获取人群列表")
    public ResultResponse getPopulation(@ApiParam("账户id") @RequestParam(value = "accountId", required = true) Long accountId) {
        return kuaishouLaunchGroupTargetService.getPopulation(accountId);
    }
    /**
     * 获取购物意图信息
     */
    @PostMapping(value = "/getPurchaseIntention")
    @ApiOperation(value = "获取购物意图信息")
    public ResultResponse getPurchaseIntention(@ApiParam("账户id") @RequestParam(value = "accountId", required = true) Long accountId) {
        return kuaishouLaunchGroupTargetService.getPurchaseIntention(accountId);
    }

    /**
     * 获取网红信息-网红查询
     */
    @PostMapping(value = "/getCelebrityInfo")
    @ApiOperation(value = "获取网红信息-网红查询")
    public ResultResponse getCelebrityInfo(@ApiParam("账户id") @RequestParam(value = "accountId", required = true) Long accountId,
                                           @ApiParam("查询关键词") @RequestParam(value = "keyword", required = false) String keyword,
                                           @ApiParam("secondLabel") @RequestParam(value = "secondLabel", required = false) String secondLabel,
                                           @ApiParam("authorId") @RequestParam(value = "authorId", required = false) Long authorId
    ) {
        return kuaishouLaunchGroupTargetService.getCelebrityInfo(accountId, keyword, secondLabel, authorId);
    }

    /**
     * 获取网红信息-网红分类
     */
    @PostMapping(value = "/getCelebrityType")
    @ApiOperation(value = "获取网红信息-网红分类")
    public ResultResponse getCelebrityType(@ApiParam("账户id") @RequestParam(value = "accountId", required = true) Long accountId) {
        return kuaishouLaunchGroupTargetService.getCelebrityType(accountId);
    }

   /**
     * 查询视频库
     */
    @PostMapping(value = "/getVideos")
    @ApiOperation(value = "查询视频库")
    public ResultResponse getVideos(@ApiParam("账户id") @RequestParam(value = "accountId", required = true) Long accountId) {
        return kuaishouLaunchGroupTargetService.getVideos(accountId);
    }


}