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

import com.cico.nest.lcdp.boot.core.qxsd.infrastructure.gatewayimpl.database.dataobject.TunnelHoleMarkerlineDO;
import com.cico.nest.lcdp.framework.common.util.json.JsonUtils;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;

@Schema(description = "管理后台 - 隧道上下行洞车道标志线 Response VO")
@Data
@ExcelIgnoreUnannotated
public class TunnelHoleMarkerlineRespVO {

    @Schema(description = "标志线主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "11861")
    @ExcelProperty("标志线主键")
    private String id;

    @Schema(description = "所属隧道id", requiredMode = Schema.RequiredMode.REQUIRED, example = "23815")
    @ExcelProperty("所属隧道id")
    private String tunnelId;

    @Schema(description = "所属洞id", requiredMode = Schema.RequiredMode.REQUIRED, example = "25864")
    @ExcelProperty("所属洞id")
    private String holeId;

    @Schema(description = "类型（车道/紧急停车带/方向线）", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    @ExcelProperty("类型（车道/紧急停车带/方向线）")
    private String type;

    @Schema(description = "标志线名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
    @ExcelProperty("标志线名称")
    private String name;

    @Schema(description = "标志线类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    @ExcelProperty("标志线类型")
    private String markerlineType;

    @Schema(description = "桩号列表")
    @ExcelProperty("桩号列表")
    private List<MileStoneVO> mileList;
    /**
     * 起止桩号数组对象 json
     */
    private String mileArray;

    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("创建时间")
    private LocalDateTime createTime;

    public static List<MileStoneVO>  convertMileList(String str){
        if (StringUtils.isNotEmpty(str)){
            return JsonUtils.parseArray(str,MileStoneVO.class);
        }
        return null;
    }
    public static String convertMileStr(List<MileStoneVO> list){
        if (CollectionUtils.isNotEmpty(list)){
            return JsonUtils.toJsonString(list);
        }
        return null;
    }
}
