package com.copy.trade.controller;

import com.alibaba.druid.util.StringUtils;
import com.copy.trade.entity.po.FollowConfig;
import com.copy.trade.entity.po.Tag;
import com.copy.trade.entity.vo.TagVo;
import com.copy.trade.enums.FollowConfigEnum;
import com.copy.trade.service.IFollowConfigService;
import com.copy.trade.service.ITagService;
import com.copy.trade.util.BeanCopior;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 配置表 前端控制器
 * </p>
 *
 * @author wz
 * @since 2022-11-12
 */
@Api(value = "跟单配置接口", tags = "跟单配置接口")
@RestController
@RequestMapping("/tag")
public class FollowConfigController {

	IFollowConfigService followConfigServiceImpl;

	/**
	 * 推荐使用构造器注入
	 * 
	 * @param followConfigServiceImpl
	 */
	@Autowired
	FollowConfigController(IFollowConfigService followConfigServiceImpl) {
		this.followConfigServiceImpl = followConfigServiceImpl;
	}

	@ApiOperation(value = "获取成为老师的最低资金要求")
	@PostMapping("/getMinAsset")
	public BigDecimal getMinAsset() {
		FollowConfig followConfig = followConfigServiceImpl
				.getConfig(FollowConfigEnum.APPLY_TRADER_MIN_ASSET.getNameEn());
		BigDecimal minAsset = (followConfig == null || StringUtils.isEmpty(followConfig.getConfigContent()))
				? new BigDecimal("1000")
				: new BigDecimal(followConfig.getConfigContent());
		return minAsset;
	}
}
