package com.muchinfo.mtp3century.controller;

import com.muchinfo.mtp3century.service.IPerformanceService;
import com.muchinfo.mtp3century.utils.AjaxResult;
import com.muchinfo.mtp3common.vo.PageResult;
import com.muchinfo.mtp3pojos.vo.performance.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/performance")
@Api(value = "履约管理API", description = "履约管理")
public class PerformanceController {

    @Resource
    private IPerformanceService iPerformanceService;

    @RequestMapping(method = RequestMethod.GET, value = "/query")
    @ApiOperation("履约管理--> 我的买履约、我的卖履约 --> 获取列表")
    @ApiResponse(code = 200, message = "成功", response = PageResult.class)
    public PageResult<PayPerformanceResult> query(PayPerformanceParam param, HttpServletRequest request) {
        return iPerformanceService.query(param, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/view")
    @ApiOperation("履约管理--> 我的买履约、我的卖履约 --> 详情")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult<PayPerformanceDetailResult> view(String planid, Integer sellorbuy, String histradedate, HttpServletRequest request) {
        return iPerformanceService.view(planid, sellorbuy, histradedate, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/doBreach")
    @ApiOperation("履约管理--> 我的买履约、我的卖履约 --> 违约申请")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult doBreach(PayPerformanceBreachParam param, HttpServletRequest request) {
        return iPerformanceService.doBreach(param, request);
    }

    @RequestMapping(method = RequestMethod.GET, value = "/doDelay")
    @ApiOperation("履约管理--> 我的买履约、我的卖履约 --> 延期申请")
    @ApiResponse(code = 200, message = "成功", response = AjaxResult.class)
    public AjaxResult doDelay(PayPerformanceDelayParam param, HttpServletRequest request) {
        return iPerformanceService.doDelay(param, request);
    }
}
