package com.muyu.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.domain.req.FaultCodeAddReq;
import com.muyu.domain.req.FaultCodeUpdReq;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

/**
 * @Author：weiran
 * @Package：com.muyu.cloud.faultmanage.domain
 * @Project：cloud-faultmanage
 * @name：FaultCode
 * @Date：2024/9/17 14:55
 */
/**
 * 故障码
 *
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@TableName(value = "car_faultcode",autoResultMap = true)
@Tag(name = "故障码")
public class FaultCode {

    /**
     *故障码Id
     */
    @TableId(value = "faultcode_id",type = IdType.AUTO)
    private long faultcodeId;
    /**
     *故障名称Id
     */
    private long messageTypeId;
    /**
     *故障码
     */
    private String faultcodeNumber;
    /**
     *故障组
     */
    private String faultGroup;
    /**
     *故障位
     */
    private String faultBit;
    /**
     *故障值
     */
    private String faultValue;
    /**
     *是否警告
     */
    private Integer isWarning;



    public static FaultCode addfaultcode(FaultCodeAddReq faultCodeAddReq){
        return FaultCode.builder()
                .faultcodeId(0)
                .messageTypeId(faultCodeAddReq.getMessageTypeId())
                .faultcodeNumber(faultCodeAddReq.getFaultcodeNumber())
                .faultGroup(faultCodeAddReq.getFaultGroup())
                .faultBit(faultCodeAddReq.getFaultBit())
                .faultValue(faultCodeAddReq.getFaultValue())
                .isWarning(faultCodeAddReq.getIsWarning())
                .build();
    }

    public static FaultCode updfaultcode(FaultCodeUpdReq faultCodeUpdReq){
        return FaultCode.builder()
                .faultcodeId(0)
                .messageTypeId(faultCodeUpdReq.getMessageTypeId())
                .faultcodeNumber(faultCodeUpdReq.getFaultcodeNumber())
                .faultGroup(faultCodeUpdReq.getFaultGroup())
                .faultBit(faultCodeUpdReq.getFaultBit())
                .faultValue(faultCodeUpdReq.getFaultValue())
                .isWarning(faultCodeUpdReq.getIsWarning())
                .build();
    }








}
