package com.muyu.domain.resp;


import com.muyu.domain.vo.FaultCodeVO;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

/**
 * 故障码信息响应对象
 * @Author：weiran
 * @Package：com.muyu.cloud.faultmanage.domain.resp
 * @Project：cloud-faultmanage
 * @name：FaultCodeListResp
 * @Date：2024/9/17 15:41
 */

@Data
@Builder
@AllArgsConstructor
@Tag(name="故障码信息响应对象",description = "故障码查询的响应结果")
public class FaultCodeListResp {

    /**
     *故障码Id
     */
    private long faultcodeId;
    /**
     *故障名称Id
     */
    private long messageTypeId;
    /**
     *故障码
     */
    private String faultcodeNumber;
    /**
     *故障组
     */
    private String faultGroup;
    /**
     *故障位
     */
    private String faultBit;
    /**
     *故障值
     */
    private String faultValue;
    /**
     *是否警告
     */
    private Integer isWarning;
    /**
     *故障类型名称
     */
    private String faulttypeName;
    /**
     * 故障名称
     */
    private String messageTypeName;
    /**
     * 报文编码
     */
    private String messageTypeCode;
    /**
     *报文所属类别
     */
    private String messageTypeBelongs;

    /**
     * 数据库对象构建为返回结果对象
     * @param faultCodeVO
     * @return
     */
    public static FaultCodeListResp faultCodeListResp(FaultCodeVO faultCodeVO){
        return FaultCodeListResp.builder()
                .faultcodeId(faultCodeVO.getFaultcodeId())
                .messageTypeId(faultCodeVO.getMessageTypeId())
                .faultcodeNumber(faultCodeVO.getFaultcodeNumber())
                .faultGroup(faultCodeVO.getFaultGroup())
                .faultBit(faultCodeVO.getFaultBit())
                .faultValue(faultCodeVO.getFaultValue())
                .isWarning(faultCodeVO.getIsWarning())
                .faulttypeName(faultCodeVO.getFaulttypeName())
                .messageTypeName(faultCodeVO.getMessageTypeName())
                .messageTypeCode(faultCodeVO.getMessageTypeCode())
                .messageTypeBelongs(faultCodeVO.getMessageTypeBelongs())
                .build();
    }
}
