package com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo;

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;
import java.util.List;

/**
 * @author zws
 * @date 2024/10/29
 */
@Data
public class TrafficFlowMetricVO {

    //隧道id
    private String tunnelId;

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

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

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

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

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

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

    //创建时间
    private Date createTime;

    //车流量
    private Integer carCount;


    public static List<TrafficFlowMetricVO> convert2VO(List<TrafficFlowMetricDO> trafficFlowMetricDOs) {
        return trafficFlowMetricDOs.stream().map(TrafficFlowMetricVO::convert2VO).toList();
    }

    public static TrafficFlowMetricVO convert2VO(TrafficFlowMetricDO trafficFlowMetricDO) {
        TrafficFlowMetricVO trafficFlowMetricVO = new TrafficFlowMetricVO();
        BeanUtils.copyProperties(trafficFlowMetricDO,trafficFlowMetricVO);
        return trafficFlowMetricVO;
    }


}
