package com.bonus.core.customer.api;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bonus.core.account.v4.constant.CardStatusEnum;
import com.bonus.core.customer.model.CustAccTemp;
import com.bonus.core.customer.service.CustAccTempService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.lang.invoke.SerializedLambda;
import java.time.LocalDateTime;
import java.util.List;

@Service
public class CustAccTempApi {
   @Autowired
   private CustAccTempService custAccTempService;

   public void update(CustAccTemp custAccTemp, Long custId) {
      this.custAccTempService.update(custAccTemp, (Wrapper)Wrappers.lambdaQuery(CustAccTemp.class).eq(CustAccTemp::getCustId, custId));
   }

   public void updateAccStatus(List<Long> custIdList, int accStatus) {
      this.custAccTempService.updateAccStatus(custIdList, accStatus);
   }

   public void updateCardStatus(Long custId, CardStatusEnum accStatusEnum) {
      this.custAccTempService.update((new CustAccTemp()).setCustId(custId).setCardStatus(accStatusEnum.getKey()));
   }

}
