package com.muyu.enterprise.domain.car;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.common.core.web.domain.BaseEntity;
import com.muyu.enterprise.domain.req.car.MessageValueAddReq;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

/**
 * @Author：李庆帅
 * @Package：com.muyu.car.domain
 * @Project：cloud-server
 * @name：MessageValue
 * @Date：2024/9/26 20:29
 *
 * 报文类型对象 message_type
 *
 */

/**
 * 报文类型实体类
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "message_value", autoResultMap = true)
public class MessageValue extends BaseEntity
{
    /**
     * 报文数据主键
     */
    @TableId(value = "message_id", type = IdType.AUTO)
    private Long messageId;

    /**
     * 模版主键
     */
    private Long templateId;

    /**
     * 报文类别
     */
    private String messageType;

    /**
     * 报文编码
     */
    private String messageCode;

    /**
     * 报文标签
     */
    private String messageLabel;

    /**
     * 起始下标
     */
    private Integer messageStartIndex;

    /**
     * 终止下标
     */
    private Integer messageEndIndex;

    public static MessageValue addBuild(MessageValueAddReq messageValueAddReq){
        return MessageValue.builder()
                .templateId(messageValueAddReq.getTemplateId())
                .messageType(messageValueAddReq.getMessageType())
                .messageCode(messageValueAddReq.getMessageCode())
                .messageLabel(messageValueAddReq.getMessageLabel())
                .messageStartIndex(messageValueAddReq.getMessageStartIndex())
                .messageEndIndex(messageValueAddReq.getMessageEndIndex())
                .build();
    }

}
