package com.happy.service.impl;

import com.happy.Model.HotelCouponStatus;
import com.happy.Until.UUIDUtil;
import com.happy.dao.AdminDao;
import com.happy.dao.HotelCoupomStatusDao;
import com.happy.service.HotelCoupomStatusService;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.UUID;

@Service("hotelCoupomStatusService")
public class HotelCoupomStatusImplService implements HotelCoupomStatusService {

    @Resource
    public HotelCoupomStatusDao hotelCoupomStatusDao;


    @Override
    public int updateLapse(List<String> id) {
        return hotelCoupomStatusDao.updateLapse(id);
    }

    @Override
    public int updateExpir(String dateTime) {
        return hotelCoupomStatusDao.updateExpir(dateTime);
    }

    @Override
    public int insert(HotelCouponStatus hotelCouponStatus) {
        return hotelCoupomStatusDao.insert(hotelCouponStatus);
    }

    @Override
    public HotelCouponStatus getById(String id) {
        return hotelCoupomStatusDao.getById(id);
    }

    @Override
    public int update(HotelCouponStatus hotelCouponStatus) {
        return hotelCoupomStatusDao.update(hotelCouponStatus);
    }

    @Override
    public List<HotelCouponStatus> getBookingId(String bookingId) {
        return hotelCoupomStatusDao.getBookingId(bookingId);
    }

    @Override
    public int restitution(List<HotelCouponStatus> list) {
        int update=0;
        for (HotelCouponStatus hotelCouponStatus : list) {
            hotelCouponStatus.setStatus(1);
            hotelCouponStatus.setBookingId("");
            hotelCouponStatus.setDiscountAmount(0.0);
             update = update(hotelCouponStatus);
        }

        return update;
    }
}
