package com.seer.teach.pay.app.channel.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.stp.StpUtil;
import com.seer.teach.common.ResultBean;
import com.seer.teach.common.annotation.DecryptionAnnotation;
import com.seer.teach.common.annotation.EncryptionAnnotation;
import com.seer.teach.pay.app.pay.controller.resp.AppPayChannelResp;
import com.seer.teach.pay.app.channel.service.AppPayChannelService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
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 java.util.List;

@RestController
@RequestMapping("/app/pay/channel")
@Tag(name = "APP-支付渠道")
@Validated
@RequiredArgsConstructor
@EncryptionAnnotation
@DecryptionAnnotation
@SaCheckLogin(type = StpUtil.TYPE)
public class AppPayChannelController {

    private final AppPayChannelService appPayChannelService;

    @Operation(summary = "支付渠道列表")
    @GetMapping("/list")
    @SaCheckPermission("app:pay:channel:list")
    public ResultBean<List<AppPayChannelResp>> getPayChannelList() {
        List<AppPayChannelResp> payChannelList = appPayChannelService.getPayChannelList();
        return ResultBean.success(payChannelList);
    }
}
