package com.crm.activity.controller.custom;

import com.crm.activity.service.ActivityRaceRuleService;
import com.crm.rely.backend.core.dto.base.BaseLongSelectDto;
import com.crm.rely.backend.core.dto.base.BaseResultDto;
import com.crm.rely.backend.model.entity.activity.ActivityRaceRuleDropDownEntity;
import org.springframework.beans.factory.annotation.Autowired;
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.RestController;

import java.util.List;

/**
 * @author y
 * @create 2022/7/21
 */
@RestController
@RequestMapping("/custom/service/activity/race/rule")
public class ActivityRaceRuleCsController {

    @Autowired
    private ActivityRaceRuleService activityRaceRuleService;

    @PostMapping("/dropdown")
    public BaseResultDto<List<BaseLongSelectDto>> dropdown(@RequestBody ActivityRaceRuleDropDownEntity entity) throws Exception {
        return BaseResultDto.success(activityRaceRuleService.getDropDownForCustomByType(entity.getCustomId(), entity.getRaceType()));
    }
}
