package com.qxgmat.data.dao.entity;

import com.alibaba.fastjson.JSONObject;
import java.io.Serializable;
import javax.persistence.*;

@Table(name = "setting")
public class Setting implements Serializable {
    @Id
    @Column(name = "`id`")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    /**
     * 配置key
     */
    @Column(name = "`key`")
    private String key;

    /**
     * 内容：json
     */
    @Column(name = "`value`")
    private JSONObject value;

    private static final long serialVersionUID = 1L;

    /**
     * @return id
     */
    public Integer getId() {
        return id;
    }

    /**
     * @param id
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * 获取配置key
     *
     * @return key - 配置key
     */
    public String getKey() {
        return key;
    }

    /**
     * 设置配置key
     *
     * @param key 配置key
     */
    public void setKey(String key) {
        this.key = key;
    }

    /**
     * 获取内容：json
     *
     * @return value - 内容：json
     */
    public JSONObject getValue() {
        return value;
    }

    /**
     * 设置内容：json
     *
     * @param value 内容：json
     */
    public void setValue(JSONObject value) {
        this.value = value;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", key=").append(key);
        sb.append(", value=").append(value);
        sb.append("]");
        return sb.toString();
    }

    public static Setting.Builder builder() {
        return new Setting.Builder();
    }

    public static class Builder {
        private Setting obj;

        public Builder() {
            this.obj = new Setting();
        }

        /**
         * @param id
         */
        public Builder id(Integer id) {
            obj.setId(id);
            return this;
        }

        /**
         * 设置配置key
         *
         * @param key 配置key
         */
        public Builder key(String key) {
            obj.setKey(key);
            return this;
        }

        /**
         * 设置内容：json
         *
         * @param value 内容：json
         */
        public Builder value(JSONObject value) {
            obj.setValue(value);
            return this;
        }

        public Setting build() {
            return this.obj;
        }
    }
}