package com.yc.ship.module.trade.api.insurance;

import com.yc.ship.framework.common.pojo.CommonResult;
import com.yc.ship.module.trade.service.insurance.InsuranceService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 */
@RestController
@Validated
public class InsuranceApiImpl implements InsuranceApi {

    @Resource
    private InsuranceService insuranceService;

    @Override
    public CommonResult<Boolean> applyInsurance(Long orderId) {
        return CommonResult.success(insuranceService.applyInsurance(orderId));
    }

    @Override
    public CommonResult<Boolean> cancelInsurance(Long orderId) {
        insuranceService.applyCancelInsurance(orderId);
        return CommonResult.success(true);
    }
}
