package com.zt.plat.module.base.controller.admin.unitConversion.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Schema(description = "管理后台 - 单位转换路径校验响应 VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class UnitConversionValidationRespVO {

    @Schema(description = "量纲ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private Long quantityId;

    @Schema(description = "量纲名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "长度")
    private String quantityName;

    @Schema(description = "量纲符号", example = "L")
    private String quantitySymbol;

    @Schema(description = "总单位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "8")
    private Integer totalUnits;

    @Schema(description = "可转换单位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "8")
    private Integer convertibleUnits;

    @Schema(description = "不可转换单位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
    private Integer unconvertibleUnits;

    @Schema(description = "是否全部可转换", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
    private Boolean allConvertible;

    @Schema(description = "基准单位信息")
    private BaseUnitInfo baseUnit;

    @Schema(description = "不可转换的单位列表")
    private List<UnconvertibleUnitInfo> unconvertibleUnitList;

    @Schema(description = "转换路径详情")
    private List<ConversionPathInfo> conversionPaths;

    @Schema(description = "基准单位信息")
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Builder
    public static class BaseUnitInfo {
        @Schema(description = "单位ID", example = "1")
        private Long unitId;

        @Schema(description = "单位名称", example = "米")
        private String unitName;

        @Schema(description = "单位符号", example = "m")
        private String unitSymbol;
    }

    @Schema(description = "不可转换单位信息")
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Builder
    public static class UnconvertibleUnitInfo {
        @Schema(description = "单位ID", example = "1")
        private Long unitId;

        @Schema(description = "单位名称", example = "光年")
        private String unitName;

        @Schema(description = "单位符号", example = "ly")
        private String unitSymbol;

        @Schema(description = "原因", example = "缺少到基准单位的转换规则")
        private String reason;
    }

    @Schema(description = "转换路径信息")
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Builder
    public static class ConversionPathInfo {
        @Schema(description = "源单位ID", example = "1")
        private Long srcUnitId;

        @Schema(description = "源单位名称", example = "千米")
        private String srcUnitName;

        @Schema(description = "目标单位ID", example = "2")
        private Long tgtUnitId;

        @Schema(description = "目标单位名称", example = "米")
        private String tgtUnitName;

        @Schema(description = "是否有直接转换", example = "true")
        private Boolean hasDirect;

        @Schema(description = "是否可通过基准单位转换", example = "true")
        private Boolean hasViaBase;

        @Schema(description = "转换路径描述", example = "千米 → 米 (直接转换)")
        private String pathDescription;
    }
}
