package com.gree.mall.miniapp.controller.acitivy;

import com.gree.mall.miniapp.bean.promotion.PromotionQuestionnaireAddBean;
import com.gree.mall.miniapp.helper.ResponseHelper;
import com.gree.mall.miniapp.logic.acitivy.PromotionQuestionnaireLogic;
import com.gree.mall.miniapp.plus.entity.PromotionQuestionnaire;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import java.util.List;


@Slf4j
@RestController
@RequiredArgsConstructor
@Api(value = "问卷活动API", tags ={"问卷活动API"} )
@RequestMapping(value = "/promotion/questionnaire", produces = "application/json; charset=utf-8")
public class PromotionQuestionnaireController {

    private final PromotionQuestionnaireLogic promotionQuestionnaireLogic;

    @PostMapping("/list")
    @ApiOperation(value = "列表")
    public ResponseHelper<List<PromotionQuestionnaire>> list(
          @ApiParam(value = "1=进行中 2=已过期 9=我参与的",required = false) @RequestParam(required = false) Integer status
    ) {
        List<PromotionQuestionnaire> list = promotionQuestionnaireLogic.list(status);
        return ResponseHelper.success(list);
    }

    @ApiOperation(value = "详情")
    @PostMapping("/detail")
    public ResponseHelper<PromotionQuestionnaireAddBean> detail(@RequestParam String id) throws Exception {
        PromotionQuestionnaireAddBean detail = promotionQuestionnaireLogic.detail(id);
        return ResponseHelper.success(detail);
    }

}
