package com.gh.gamecenter.db.info;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

@DatabaseTable(tableName = "tb_ask_search")
public class AskSearchHistoryInfo implements Serializable {

    /**
     *
     */
    private static final long serialVersionUID = 1L;

    @DatabaseField(id = true, columnName = "id")
    private String id;

    @DatabaseField(columnName = "key")
    private String key;

    @DatabaseField(columnName = "time")
    private String time;

    @DatabaseField(columnName = "communityId")
    private String communityId;

    public AskSearchHistoryInfo() {

    }

    public AskSearchHistoryInfo(String key, String communityId) {
        this.key = key;
        this.communityId = communityId;
        Date date = new Date();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss",
                Locale.getDefault());
        this.time = format.format(date);
        this.id = String.valueOf(date.getTime());
    }

    public String getId() {
        return id;
    }

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

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public String getCommunityId() {
        return communityId;
    }

    public void setCommunityId(String communityId) {
        this.communityId = communityId;
    }

    @Override
    public String toString() {
        return "AskSearchHistoryInfo{" +
                "key='" + key + '\'' +
                ", time='" + time + '\'' +
                ", communityId='" + communityId + '\'' +
                '}';
    }
}
