package com.gree.mall.manager.controller.fadada;

import com.gree.mall.manager.helper.ResponseHelper;
import com.gree.mall.manager.utils.fadada.Auth4FDDUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(value = "法大大通用API", tags ={"法大大通用API"} )
@RequestMapping("/fdd/common")
public class ContractCommonController {

    @PostMapping("/view/template")
    @ApiOperation(value = "查看模板")
    public ResponseHelper<String> viewTemplate(@RequestParam String templateId) {
        String url = Auth4FDDUtil.queryContractTemplate(templateId);
        return ResponseHelper.success(url);
    }

    @PostMapping("/view/contract")
    @ApiOperation(value = "查看合同")
    public ResponseHelper<String> viewContract(@RequestParam String contractId) {
        String url = Auth4FDDUtil.viewContract(contractId);
        return ResponseHelper.success(url);
    }

    @PostMapping("/download/contract")
    @ApiOperation(value = "下载合同")
    public ResponseHelper<String> downloadContract(@RequestParam String contractId) {
        String url = Auth4FDDUtil.downloadContract(contractId);
        return ResponseHelper.success(url);
    }
}
