package com.muyu.domain.resp;

import com.muyu.domain.MessageTemplate;
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: MessageTemplateListResp
 * @Date: 2024/9/18  21:15
 * @Description: 报文模版响应数据
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Tag(name = "报文模版列表", description = "负责报文模版管理列表的相应数据")
public class MessageTemplateListResp {

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

    /**
     * 报文模版名称
     */
    @Schema(type = "String",title = "报文模版名称")
    private String messageTemplateName;

    /**
     * 报文模版描述
     */
    @Schema(type = "String",title = "报文模版描述")
    private String messageTemplateDescribe;

    /**
     * 数据库对象构建为返回结果对象
     * @param messageTemplate
     * @return
     */
    public static MessageTemplateListResp messageTemplateBuild(MessageTemplate messageTemplate) {
        return MessageTemplateListResp.builder()
                .messageTemplateId(messageTemplate.getMessageTemplateId())
                .messageTemplateName(messageTemplate.getMessageTemplateName())
                .messageTemplateDescribe(messageTemplate.getMessageTemplateDescribe())
                .build();
    }
}
