package com.muyu.domain.resp;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
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;

/**
 * @ClassName MessageValueListResp
 * @Description TODO
 * @Author LiHD
 * @Date 2024/9/19
 */

/**
 * 报文数据列表的相应数据
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Tag(name = "报文数据列表", description = "负责报文数据管理列表的相应数据")
@TableName(value = "message_value", autoResultMap = true)
public class MessageValueListResp {

    /**
     * 报文数据主键
     */
    @TableId(value = "message_id", type = IdType.AUTO)
    @Schema(description = "报文数据主键",example = "1")
    private Long messageId;

    /**
     * 报文类别
     */
    @Schema(description = "报文类别",example = "1")
    private String messageType;

    /**
     * 报文编码
     */
    @Schema(description = "报文编码",example = "1")
    private String messageCode;

    /**
     * 报文标签
     */
    @Schema(description = "报文标签",example = "1")
    private String messageLabel;

    /**
     * 起始下标
     */
    @Schema(description = "起始下标",example = "1")
    private Integer messageStartIndex;

    /**
     * 终止下标
     */
    @Schema(description = "终止下标",example = "1")
    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();
    }
}
