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 io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

/**

 */

/**
 * 故障码实体类
 *  * @className: FaultCode  ️✈️
 *  * @author: Yang 鹏  🦅
 *  * @date: 2024/9/23 22:21 ⏰
 *  * @Version: 1.0
 *  * @description:
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@TableName(value = "car_faultcode", autoResultMap = true)
@Tag(name = "故障码管理")
public class FaultCode {
    /**
     * 故障码Id
     */
    @TableId(value = "faultcode_id", type = IdType.AUTO)
    @Schema(name = "故障码Id")
    private Long faultcodeId;
    /**
     * 故障名称Id
     */
    @Schema(name = "故障名称Id")
    private Long messageTypeId;
    /**
     * 故障码
     */
    @Schema(name = "故障码")
    private String faultcodeNumber;
    /**
     * 故障组
     */
    @Schema(name = "故障组")
    private String faultGroup;
    /**
     * 故障位
     */
    @Schema(name = "故障位")
    private String faultBit;
    /**
     * 故障值
     */
    @Schema(name = "故障值")
    private String faultValue;
    /**
     * 是否警告
     */
    @Schema(name = "是否警告")
    private Integer isWarning;

    /**
     * 故障类型名称
     */
    @Schema(name = "故障类型名称")
    private String faulttypeName;
    /**
     * 故障类型编码
     */
    @Schema(name = "故障类型编码")
    private String messageTypeName;
    /**
     * 故障类型所属
     */
    @Schema(name = "故障类型所属")
    private String messageTypeCode;
    /**
     * 故障类型所属
     */
    @Schema(name = "故障类型所属")
    private String messageTypeBeLongs;

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