package org.dromara.mp.controller;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.domain.R;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.log.enums.OperatorType;
import org.dromara.common.web.core.BaseController;
import org.dromara.mp.domain.vo.UserWorkerAccountVo;
import org.dromara.mp.service.ISettlementAccountService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

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

/**
 * @author sunzexing
 * @version 1.0
 * @title SettlementAccountController
 * @description  个人中心-结算账户
 * @create 2024-05-08 14:09
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/sac")
@Slf4j
public class SettlementAccountController extends BaseController {


    @Resource
    private ISettlementAccountService settlementAccountService;


    /***
     * 获取结算通道
     * @return
     */
    @GetMapping("/getSettleChannel")
    @Log(title = "获取结算通道", businessType = BusinessType.SELECT,operatorType= OperatorType.MOBILE)

//    @Log(title = "公众号获取结算通道", businessType = BusinessType.SELECT)
    public R<List> getSettleChannel(){
        return R.ok(this.settlementAccountService.getSettleChannel());
    }



    @GetMapping("/getBanks")
    @Log(title = "获取银行列表", businessType = BusinessType.SELECT,operatorType= OperatorType.MOBILE)
//    @Log(title = "公众号获取银行", businessType = BusinessType.SELECT)
    public R<List> getBankList(String bankName){
        return R.ok(this.settlementAccountService.getBankList(bankName));
    }




    @GetMapping("/getDetail")
//    @Log(title = "公众号获取银行卡详情", businessType = BusinessType.SELECT)
    @Log(title = "获取银行卡详情", businessType = BusinessType.SELECT,operatorType= OperatorType.MOBILE)
    public R<UserWorkerAccountVo>  getBankDetail(Long id){
        return R.ok(this.settlementAccountService.getBankDetail(id));
    }


}
