package com.red.circle.console.adapter.app.sys.pay;


import com.red.circle.console.app.service.app.sys.pay.SysPayApplicationService;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.order.inner.model.dto.SysPayApplicationDTO;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
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;

/**
 * 开放支付国家 前端控制器.
 *
 * @author pengliang
 * @since 2021-11-29
 */
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/sys-pay-application", produces = MediaType.APPLICATION_JSON_VALUE)
public class SysApplicationController extends BaseController {

  private final SysPayApplicationService sysPayApplicationService;

  /**
   * 开通应用列表.
   */
  @GetMapping("/list")
  public List<SysPayApplicationDTO> listApplication() {
    return sysPayApplicationService.listApplication();
  }

  /**
   * 开通应用-添加.
   */
  @PostMapping("/add")
  public void addApplication(@RequestBody @Validated SysPayApplicationDTO param) {
    sysPayApplicationService.addApplication(param);
  }

  /**
   * 开通应用-修改.
   */
  @PostMapping("/update")
  public void updateApplication(@RequestBody @Validated SysPayApplicationDTO param) {
    sysPayApplicationService.updateApplication(param);
  }

}
