package com.qmth.themis.business.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.qmth.themis.business.util.UidUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;

/**
 * <p>
 * ip信息表
 * </p>
 *
 * @author wangliang
 * @since 2022-08-18
 */
@ApiModel(value = "TIpRegion对象", description = "ip信息表")
public class TIpRegion implements Serializable {

    private static final long serialVersionUID = 1L;

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

    @ApiModelProperty(value = "考试记录id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long examRecordId;

    @ApiModelProperty(value = "国家")
    private String country;

    @ApiModelProperty(value = "地区")
    private String region;

    @ApiModelProperty(value = "省份")
    private String province;

    @ApiModelProperty(value = "城市")
    private String city;

    @ApiModelProperty(value = "运营商")
    private String isp;

    @ApiModelProperty(value = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)//新增执行
    private Long createTime;

    @TableField(value = "update_Time", fill = FieldFill.INSERT_UPDATE) // 新增和更新执行
    @ApiModelProperty(value = "更新时间")
    private Long updateTime;

    public TIpRegion() {

    }

    public TIpRegion(Long examRecordId, String country, String region, String province, String city, String isp) {
        this.id = UidUtil.nextId();
        this.examRecordId = examRecordId;
        this.country = country;
        this.region = region;
        this.province = province;
        this.city = city;
        this.isp = isp;
        this.createTime = System.currentTimeMillis();
    }

    public void updateInfo(String country, String region, String province, String city, String isp) {
        this.country = country;
        this.region = region;
        this.province = province;
        this.city = city;
        this.isp = isp;
        this.updateTime = System.currentTimeMillis();
    }

    public Long getId() {
        return id;
    }

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

    public Long getExamRecordId() {
        return examRecordId;
    }

    public void setExamRecordId(Long examRecordId) {
        this.examRecordId = examRecordId;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    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 getIsp() {
        return isp;
    }

    public void setIsp(String isp) {
        this.isp = isp;
    }

    public Long getCreateTime() {
        return createTime;
    }

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

    public Long getUpdateTime() {
        return updateTime;
    }

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