package com.crm.manager.controller;

import com.crm.manager.service.ib.AgentApplyFeignService;
import com.crm.rely.backend.core.dto.base.BaseResultDto;
import com.crm.rely.backend.core.dto.base.BaseResultWithPagerDto;
import com.crm.rely.backend.core.dto.ib.apply.AgentApplyDto;
import com.crm.rely.backend.core.entity.custom.info.InfoEntity;
import com.crm.rely.backend.core.entity.ib.apply.AgentApplyApproveEntity;
import com.crm.rely.backend.core.entity.ib.apply.AgentApplyListEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
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;

/**
 * Created by max on 2020/8/27.
 */
@RestController
@RequestMapping("/agent/apply")
public class AgentApplyController {

    @Autowired
    private AgentApplyFeignService agentApplyFeignService;

    @PostMapping("/list")
    public BaseResultWithPagerDto<List<AgentApplyDto>> add(@RequestBody AgentApplyListEntity entity, InfoEntity infoEntity) throws Exception {
        return agentApplyFeignService.getList(entity);
    }

    @PostMapping("/approve")
    public BaseResultDto<Object> approve(@RequestBody @Validated AgentApplyApproveEntity entity, InfoEntity infoEntity) throws Exception {
        return agentApplyFeignService.approve(entity);
    }

}
