package cn.estsh.i3plus.pojo.platform.bean;

import cn.estsh.i3plus.pojo.base.annotation.AnnoOutputColumn;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * @Description : 系统配置 分支测试
 * @Reference   :
 * @Author      : wei.peng
 * @Date        : 2018-10-22 16:58:43.499
 * @Modify      :
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name="SYS_CONFIG")
@Api(value="系统配置",description = "系统配置")
public class SysConfig extends BaseBean {

    private static final long serialVersionUID = 2718495807943432629L;
    @Column(name="NAME")
    @ApiParam(value ="名称")
    private String name;

    @Column(name="SOFT_TYPE")
    @ApiParam(value ="产品类型")
    private Integer softType;

    public String getSoftTypeTxt() {
        return softType == null ? null : CommonEnumUtil.SOFT_TYPE.valueOfDescription(softType);
    }

    @Column(name="CONFIG_TYPE")
    @ApiParam(value ="参数类型ID（枚举：1.系统配置...）" , example ="-1")
    private Integer configType;

    @Column(name="CONFIG_CODE")
    @ApiParam(value ="参数代码")
    private String configCode;

    // 枚举 ImppEnumUtil.SYS_CONFIG_GROUP
    @Column(name="CONFIG_GROUP")
    @ApiParam(value ="参数组")
    @AnnoOutputColumn(refClass = ImppEnumUtil.SYS_CONFIG_GROUP.class)
    private Integer configGroup;

    // 枚举 ImppEnumUtil.SYS_VALUE_TYPE
    @Column(name="CONFIG_VALUE_TYPE")
    @ApiParam(value ="参数值类型")
    private String configValueType;

    @Column(name="CONFIG_VALUE")
    @ApiParam(value ="参数值")
    private String configValue;

    @Column(name="CONFIG_VALUE_OPTION")
    @ApiParam(value ="参数值选项（参数类型为多选时使用），格式：{\"key\":\"value\"}")
    private String configValueOption;

    @Column(name="CONFIG_DESCRIPTION")
    @ApiParam(value ="参数描述")
    private String configDescription;

}
