package cn.superdesk.uniorder.dubbo.consumer.operationCenter.customer;

import cn.superdesk.uniorder.common.rest.response.R;
import cn.superdesk.uniorder.common.security.JwtUtil;
import cn.superdesk.uniorder.common.security.dto.LoginSysUser;
import cn.superdesk.uniorder.dto.param.operationCenter.base.OperationCenterBaseParam;
import cn.superdesk.uniorder.dto.param.operationCenter.customer.OperationCenterBillStartParam;
import cn.superdesk.uniorder.dto.vo.operationCenter.customer.OperationCenterBillStartVo;
import cn.superdesk.uniorder.dubbo.facade.operationCenter.customer.DubboOperationCenterBillStartService;
import com.alibaba.dubbo.config.annotation.Reference;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author : zx
 * @Create : 2023/4/11 09:46
 * Description :
 */
@Slf4j
@Component
public class OperationCenterBillStartDubboService {
    @Reference(version = "1.0.0", timeout = 30000, retries = -1)
    private DubboOperationCenterBillStartService dubboOperationCenterBillStartService;

    public R<List<OperationCenterBillStartVo>> getBillStartListByCustomerId(OperationCenterBaseParam param) {
        return dubboOperationCenterBillStartService.getBillStartListByCustomerId(param);
    }

    public R<String> saveOperationCenterBillStart(OperationCenterBillStartParam param, String token) {
        LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);
        return  dubboOperationCenterBillStartService.saveOperationCenterBillStart(param,loginSysUser.getSysUserId());
    }

    public R<OperationCenterBillStartVo> getBillStartById(Long id) {
        return dubboOperationCenterBillStartService.getBillStartById(id);
    }

    public R<String> deleteOperationCenterBillStartById(Long id, String token) {
        LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);
        return dubboOperationCenterBillStartService.deleteOperationCenterBillStartById(id,loginSysUser.getSysUserId());
    }

    public R<String> enableOperationCenterBillStartById(Long billId, String token) {
        LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);
        return dubboOperationCenterBillStartService.enableOperationCenterBillStartById(billId, loginSysUser.getSysUserId());
    }
}
