/**
 * @filename:CreditScoreQuotaController 2024-06-11
 * @project trade-client V1.0 Copyright(c) 2024 wanglang Co. Ltd. All right reserved.
 */
package com.trade.client.advocacypage.controller;

import com.trade.client.advocacypage.dto.CreditQuotaContext;
import com.trade.client.advocacypage.dto.EstimatedCreditQuotaDto;
import com.trade.client.advocacypage.service.CreditScoreQuotaService;
import com.trade.common.core.domain.ResponseResult;
import com.trade.service.system.domain.SysCountry;
import com.trade.service.system.service.SysCountryService;
import io.swagger.annotations.ApiOperation;
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 io.swagger.annotations.Api;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 说明： 授信分数额度API接口层
 * </P>
 * 
 * @version: V1.0
 * @author: wanglang
 * @time 2024-06-11
 */
@Api(tags = "授信分数额度", value = "授信分数额度")
@RestController
@RequestMapping("/creditScoreQuota")
public class CreditScoreQuotaController {

    private final CreditScoreQuotaService creditScoreQuotaService;
    private final SysCountryService sysCountryService;

    public CreditScoreQuotaController(CreditScoreQuotaService creditScoreQuotaService,
            SysCountryService sysCountryService){
        this.creditScoreQuotaService = creditScoreQuotaService;
        this.sysCountryService = sysCountryService;
    }

    @ApiOperation(value = "获取预估额度", notes = "获取预估额度")
    @PostMapping("/get")
    public ResponseResult<CreditQuotaContext> getCreditScoreQuota(@RequestBody EstimatedCreditQuotaDto creditQuotaDto) {
        return ResponseResult.success(creditScoreQuotaService.getCreditScoreQuota(creditQuotaDto));
    }

    @ApiOperation(value = "获取国家列表", notes = "获取国家列表")
    @PostMapping("/getCountry")
    public ResponseResult<List<SysCountry>> getCountryList(String continent) {
        return ResponseResult.success(sysCountryService.queryCountryListByContinent(continent));
    }
}
