package cn.com.qmth.stmms.biz.school.model;

import cn.com.qmth.stmms.common.utils.AccessControlUtils;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Entity
@Table(name = "b_school")
public class School implements Serializable {

    private static final int ACCESS_SECRET_LENGTH = 24;

    private static final long serialVersionUID = -241744624240739912L;

    /**
     * 主键
     */
    @Id
    @GeneratedValue
    private Integer id;

    /**
     * 名称
     */
    private String name;

    /**
     * 代码
     */
    private String code;

    /**
     * 省份
     */
    private String province;

    /**
     * 城市
     */
    private String city;

    /**
     * 地址
     */
    private String address;

    /**
     * 电话
     */
    private String phone;

    /**
     * 图片地址、名称
     */
    @Column(name = "logo_url")
    private String logoUrl;

    /**
     * 描述
     */
    private String description;

    /**
     * 是否启用
     */
    private boolean enable;

    /**
     * 双评轨迹
     */
    @Column(name = "double_track")
    private boolean doubleTrack;

    @Column(name = "access_key", nullable = true, length = 64)
    private String accessKey;

    @Column(name = "access_secret", nullable = true, length = 64)
    private String accessSecret;

    @Column(name = "create_time")
    private Date createTime;

    @Column(name = "update_time")
    private Date updateTime;

    @Column(name = "parent_id", nullable = true)
    private Integer parentId;

    @Column(name = "sub_code", nullable = true)
    private String subCode;

    @Column(name = "group_delete_check", nullable = false)
    private boolean groupDeleteCheck;

    public Integer getId() {
        return id;
    }

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

    public String getName() {
        return name;
    }

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

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getLogoUrl() {
        return logoUrl;
    }

    public void setLogoUrl(String logoUrl) {
        this.logoUrl = logoUrl;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public boolean isEnable() {
        return enable;
    }

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

    public String getAccessKey() {
        return accessKey;
    }

    public void setAccessKey(String accessKey) {
        this.accessKey = accessKey;
    }

    public String getAccessSecret() {
        return accessSecret;
    }

    public void setAccessSecret(String accessSecret) {
        this.accessSecret = accessSecret;
    }

    public void resetAccessKeyAndSecret() {
        accessKey = AccessControlUtils.uuidString();
        accessSecret = AccessControlUtils.randomString(ACCESS_SECRET_LENGTH);
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getCode() {
        return code;
    }

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

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    public String getSubCode() {
        return subCode;
    }

    public void setSubCode(String subCode) {
        this.subCode = subCode;
    }

    public boolean isDoubleTrack() {
        return doubleTrack;
    }

    public void setDoubleTrack(boolean doubleTrack) {
        this.doubleTrack = doubleTrack;
    }

    public boolean isGroupDeleteCheck() {
        return groupDeleteCheck;
    }

    public void setGroupDeleteCheck(boolean groupDeleteCheck) {
        this.groupDeleteCheck = groupDeleteCheck;
    }

}
