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

import com.cico.nest.lcdp.boot.core.qxsd.adapter.web.vo.tunnelFacility.TunnelSectionCongestionStatusVO;
import lombok.Data;

import java.util.List;

/**
 *
 * 断面拥堵状态
 * @author zws
 * @date 2024/8/12
 */

@Data
public class XlwSectionCongestionStatusDTO {

    /**
     * 隧道id
     */
    private String tunnelId;


    private List<Status> situations;

    @Data
    public  static class Status {
        /**
         * 通行等级 -1:通常  0:轻度拥堵 1:中度拥堵 2:严重拥堵
         */
        private Integer level;

        /**
         * 开始桩号
         */
        private String startMilestone;

        /**
         * 结束桩号
         */
        private String endMilestone;
    }


    public static List<TunnelSectionCongestionStatusVO> dto2VO(List<Status> dtos){
        return dtos.stream().map(XlwSectionCongestionStatusDTO::dto2VO).toList();
    }

    public static TunnelSectionCongestionStatusVO dto2VO(Status dto){
        TunnelSectionCongestionStatusVO vo = new TunnelSectionCongestionStatusVO();
        vo.setStartMilestone(dto.getStartMilestone());
        vo.setEndMilestone(dto.getEndMilestone());
        vo.setLevel(dto.getLevel());
        return vo;
    }


}
