package cn.axzo.msg.center.message.domain.param;

import cn.axzo.core.utils.converter.BeanConverter;
import cn.axzo.msg.center.service.enums.MessageGroupNodeCategoryEnum;
import cn.axzo.msg.center.service.group.request.MessageGroupNodeAddRequest;
import cn.axzo.msg.center.service.group.request.MessageGroupNodeUpdateRequest;
import com.alibaba.fastjson.JSON;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * @author cold_blade
 * @date 2023/10/17
 * @version 1.0
 */
@Setter
@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class MessageGroupNodeSaveOrUpdateParam {

    /**
     * 操作者的自然人id
     */
    private Long operatorId;
    /**
     * 父节点编码
     */
    private String parentNodeCode;
    /**
     * 待添加结点名称
     */
    private String nodeName;
    /**
     * 待修改的结点编码
     */
    private String nodeCode;
    /**
     * 待添加结点类型
     *   GENERAL_MESSAGE_CENTER:  通知的业务中心
     *   GENERAL_MESSAGE_MODULE:  消息模块
     *   GENERAL_MESSAGE_CATEGORY:  消息分类
     *   PENDING_MESSAGE_CENTER:  待办的业务中心
     *   PENDING_MESSAGE_MODULE:  待办模块
     *   PENDING_MESSAGE_CATEGORY:  待办分类
     */
    private MessageGroupNodeCategoryEnum category;
    /**
     * 待添加结点图标
     */
    private String icon;

    public static MessageGroupNodeSaveOrUpdateParam from(MessageGroupNodeAddRequest request) {
        return BeanConverter.convert(request, MessageGroupNodeSaveOrUpdateParam.class);
    }

    public static MessageGroupNodeSaveOrUpdateParam from(MessageGroupNodeUpdateRequest request) {
        return BeanConverter.convert(request, MessageGroupNodeSaveOrUpdateParam.class);
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }
}
