package com.ruoyi.project.business.domain.vo.quotation;

import com.ruoyi.project.business.domain.TqSpecificationDetail;
import com.ruoyi.project.business.domain.TqSpecificationParabarDetail;
import com.ruoyi.project.business.enums.ParamTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class SpecificationParamVO {

    private String paraCategory;

    private String paraCode;

    private String paraValue;

    /**
     * 参数包id
     */
    private Long parabarId;

    /**
     * 参数包配置id
     */
    private Long parabarDetailId;

    private String paramType;

    private String paraSource;

    public static SpecificationParamVO covertNormal(TqSpecificationDetail detail) {
        return SpecificationParamVO.builder()
            .paraCategory(detail.getParaCategory())
            .paraCode(detail.getParaCode())
            .paraValue(detail.getParaValue())
            .paramType(ParamTypeEnum.NORMAL.getCode())
            .build();
    }

    public static SpecificationParamVO covertParabar(TqSpecificationDetail detail) {
        return SpecificationParamVO.builder()
            .paraCategory(detail.getParaCategory())
            .parabarId(detail.getParabarId())
            .parabarDetailId(detail.getParabarDetailId())
            .paraCode(detail.getParaCode())
            .paraValue(detail.getParaValue())
            .paramType(ParamTypeEnum.BAR_PARAM.getCode())
            .build();
    }
}
