package com.muyu.domain.resp;

import com.muyu.domain.MessageValue;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author: LiDongJia
 * @Package: com.muyu.car.domain.resp
 * @Project: 2112-car-cloud-server
 * @name: MessageValueListResp
 * @Date: 2024/9/19  15:52
 * @Description: 报文数据响应数据
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Tag(name = "报文数据列表", description = "负责报文数据管理列表的相应数据")
public class MessageValueListResp {

    /**
     * 报文数据主键
     */
    @Schema(type = "Long",title = "报文数据主键")
    private Long messageId;

    /**
     * 报文类别
     */
    @Schema(type = "String",title = "报文类别")
    private String messageType;

    /**
     * 报文编码
     */
    @Schema(type = "String",title = "报文编码")
    private String messageCode;

    /**
     * 报文标签
     */
    @Schema(type = "String",title = "报文标签")
    private String messageLabel;

    /**
     * 起始下标
     */
    @Schema(type = "Integer",title = "起始下标")
    private Integer messageStartIndex;

    /**
     * 报文模版外键
     */
    @Schema(type = "Long",description = "报文模版主键")
    private Long messageTemplateId;

    /**
     * 终止下标
     */
    @Schema(type = "Integer",title = "终止下标")
    private Integer messageEndIndex;

    public static MessageValueListResp valueBuild(MessageValue messageValue){
        return MessageValueListResp.builder()
                .messageId(messageValue.getMessageId())
                .messageType(messageValue.getMessageType())
                .messageCode(messageValue.getMessageCode())
                .messageLabel(messageValue.getMessageLabel())
                .messageStartIndex(messageValue.getMessageStartIndex())
                .messageEndIndex(messageValue.getMessageEndIndex())
                .build();
    }
}
