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.MessageTemplateAddReq;
import com.muyu.common.core.web.domain.BaseEntity;
import com.muyu.domain.req.MessageTemplateAddReq;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

/**
 * 报文模版实体类
 *  * @ClassName MessageTemplate
 *  * @Description TODO
 *  * @Author Li HD
 *  * @Date 2024/9/19
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName(value = "message_template", autoResultMap = true)
@Tag(name = "报文模版管理")
public class MessageTemplate extends BaseEntity {

    /**
     * 报文模版主键
     */
    @TableId(value = "message_template_id", type = IdType.AUTO)
    @Schema(title = "报文模版主键")
    private String messageTemplateId;

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

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

    /**
     * 报文模版添加数据转换
     * @param messageTemplateAddReq
     * @return
     */
    public static MessageTemplate addBuild(MessageTemplateAddReq messageTemplateAddReq){
        return MessageTemplate.builder()
                .messageTemplateName(messageTemplateAddReq.getMessageTemplateName())
                .messageTemplateDescribe(messageTemplateAddReq.getMessageTemplateDescribe())
                .build();
    }

}
