package cn.axzo.msg.center.domain.entity;

import cn.axzo.msg.center.domain.persistence.BaseEntityExt;
import cn.axzo.msg.center.service.enums.PresetButtonType;
import cn.axzo.msg.center.service.enums.RouterButtonSourceEnum;
import cn.axzo.msg.center.service.enums.RouterCategoryEnum;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;

/**
 * 消息路由按钮
 *
 * @author cold_blade
 * @date 2023/11/7
 * @version 1.0
 */
@Setter
@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "message_route_button", autoResultMap = true)
public class MessageRouteButton extends BaseEntityExt<MessageRouteButton> implements Serializable {

    private static final long serialVersionUID = 2815163121368837804L;

    /**
     * 按钮名称
     */
    private String name;
    /**
     * 按钮唯一标识
     */
    private String btnCode;
    /**
     * 预设按钮类型
     */
    private PresetButtonType presetBtnCode;
    /**
     * 模板code
     */
    private String templateCode;
    /**
     * 按钮来源
     */
    private RouterButtonSourceEnum source;
    /**
     * 路由类型
     */
    private RouterCategoryEnum category;
    /**
     * API地址,仅当按钮是接口调用类型时有值
     */
    private String apiUrl;
    /**
     * 按钮style配置
     */
    @TableField(typeHandler = FastjsonTypeHandler.class)
    private JSONArray style;
    /**
     * 执行人可见：true 不可见：false
     */
    private Boolean executorShow;
    /**
     * 待办状态可见可见：true 不可见：false
     */
    private Boolean pendingShow;
    /**
     * 按钮优先级，数值越大优先级越低
     */
    private Integer priority;

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