package com.qmth.jkserver.dto.result;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qmth.jkserver.model.SysConfig;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.List;

/**
 * @Description: 系统参数result
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2022/11/30
 */
public class SysConfigResult implements Serializable {

    private static final long serialVersionUID = 1L;

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "主键")
    private Long id;

    @ApiModelProperty(value = "参数编码")
    private String code;

    @ApiModelProperty(value = "参数名称")
    private String name;

    @ApiModelProperty(value = "参数值")
    private Object value;

    @ApiModelProperty(value = "启用/禁用，ture：启用，false：禁用，默认启用")
    private Boolean enable = true;

    @ApiModelProperty(value = "排序")
    private Integer sort = 1;

    private List<SysConfigResultOption> options;

    public SysConfigResult() {

    }

    public SysConfigResult(Long id, String code, String name, Object value, Integer sort) {
        this.id = id;
        this.code = code;
        this.name = name;
        this.value = value;
        this.sort = sort;
    }

    public SysConfigResult(SysConfig sysConfig) {
        this.id = sysConfig.getId();
        this.code = sysConfig.getConfigKey();
        this.name = sysConfig.getConfigName();
        this.value = sysConfig.getConfigValue();
        this.enable = sysConfig.getEnable();
        this.sort = sysConfig.getSort();
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Object getValue() {
        return value;
    }

    public void setValue(Object value) {
        this.value = value;
    }

    public Boolean getEnable() {
        return enable;
    }

    public void setEnable(Boolean enable) {
        this.enable = enable;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public List<SysConfigResultOption> getOptions() {
        return options;
    }

    public void setOptions(List<SysConfigResultOption> options) {
        this.options = options;
    }

}
