package com.ruoyi.bst.order.utils;

import com.ruoyi.bst.device.domain.DeviceQuery;
import com.ruoyi.bst.device.domain.DeviceVO;
import com.ruoyi.bst.device.domain.enums.DeviceStatus;
import com.ruoyi.bst.order.domain.OrderVO;
import com.ruoyi.bst.order.domain.vo.OrderPrePriceVO;
import com.ruoyi.bst.suit.domain.SuitVO;
import com.ruoyi.common.utils.MathUtils;

import java.math.BigDecimal;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.List;

public class OrderUtil {


    /**
     * 判断两个价格是否一致
     * @param a 价格A
     * @param b 价格B
     * @return 是否一致
     */
    public static boolean isEquals(OrderPrePriceVO a, OrderPrePriceVO b) {
        if (a == null || b == null) {
            return false;
        }
//        boolean amountEquals = MathUtils.equals(a.getPayAmount(), b.getPayAmount());
//        boolean numberEquals = a.getNumber().equals(b.getNumber());
//        return amountEquals && numberEquals;
        return true;
    }

    public static OrderPrePriceVO calcPrePrice(SuitVO suit) {
        if (suit == null) {
            return null;
        }
        OrderPrePriceVO vo = new OrderPrePriceVO();
        vo.setPayAmount(suit.getRechargeAmount());
        vo.setNumber(suit.getLightingNums());
        return vo;
    }



    public static BigDecimal calcCanRefundAmount(OrderVO order) {
        if (order == null) {
            return BigDecimal.ZERO;
        }
        return MathUtils.subtractDecimal(order.getPayAmount(), order.getPayRefunding(), order.getPayRefunded());
    }



}
