package com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.http.xlw.dto;

import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.TrafficFlowMetricDO;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.Date;

/**
 * @author zws
 * @date 2024/8/8
 */

@Data
public class XlwTrafficFlowMetricDTO {

    //统计时间, 格式：yyyyMMddhhmm
    private Long statisticsMinute;

    //最大平均时速
    private Float maxAverageSpeed;

    //最大车头时距
    private Float maxTimeHeadway;

    //最大车道占有率
    private Float maxLaneOccupancyRatio;

    //最小平均时速
    private Float minAverageSpeed;

    //最小车头时距
    private Float minTimeHeadway;

    //最小车道占有率
    private Float minLaneOccupancyRatio;


    public static TrafficFlowMetricDO convert2DO(XlwTrafficFlowMetricDTO dto,String tunnelId){
        if (dto==null){
            return null;
        }
        TrafficFlowMetricDO trafficFlowMetricDO = new TrafficFlowMetricDO();
        BeanUtils.copyProperties(dto,trafficFlowMetricDO);
        trafficFlowMetricDO.setTunnelId(tunnelId);
        trafficFlowMetricDO.setCreateTime(new Date());
        return trafficFlowMetricDO;
    }

}
