package com.ruoyi.bst.orderDevice.domain;

import java.math.BigDecimal;
import java.time.LocalDateTime;

import com.ruoyi.common.utils.MathUtils;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
public class OrderDeviceVO extends OrderDevice{

    @ApiModelProperty("订单编号")
    private String orderNo;

    @ApiModelProperty("设备剩余电量（%）")
    private BigDecimal deviceRemainingPower;

    @ApiModelProperty("设备锁状态")
    private String deviceLockStatus;
    
    @ApiModelProperty("订单用户ID")
    private Long orderUserId;

    @ApiModelProperty("订单用户名称")
    private String orderUserName;

    @ApiModelProperty("商户名称")
    private String deviceMchName;

    @ApiModelProperty("订单开始时间")
    private LocalDateTime orderStartTime;

    @ApiModelProperty("订单结束时间")
    private LocalDateTime orderEndTime;

    @ApiModelProperty("订单最大可用时间")
    private LocalDateTime orderMaxTime;

    @ApiModelProperty("订单运营区ID")
    private Long orderAreaId;

    @ApiModelProperty("运营区是否开启还车审核")
    private Boolean orderAreaReturnVerify;

    // 设备剩余续航（公里）
    public BigDecimal getDeviceRemainEndurance() {
        BigDecimal remainEndurance = MathUtils.mulDecimal(getDeviceRemainingPower(), getDeviceModelFullEndurance());
        return remainEndurance.divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);
    }
}
