package cc.iotkit.data.model;

import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.listener.TenantListener;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.*;
import org.hibernate.annotations.Filter;
import org.hibernate.annotations.FilterDef;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.ParamDef;

import javax.persistence.*;
import java.time.LocalDateTime;

// 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库，可不写。
@Data
@Entity
@Table(name = "t_d_iccid_record")
@AutoMapper(target= cc.iotkit.model.iccid.DIccidRecordDO.class)
@FilterDef(name = "tenantFilter", parameters = {@ParamDef(name = "tenantId", type = "long")})
@Filter(name = "tenantFilter", condition = "tenant_id = :tenantId")
@EntityListeners(TenantListener.class)
public class TbDIccidRecordDO extends BaseEntity implements TenantAware {

    /**
     * 主键
     */
    //@TableId(type = IdType.AUTO)
    @Id
    @GeneratedValue(generator = "SnowflakeIdGenerator")
    @GenericGenerator(name = "SnowflakeIdGenerator", strategy = "cc.iotkit.data.config.id.SnowflakeIdGenerator")
    private Long id;
    /**
     * 厂商编号|合作商编号
     */
    private String userCode;
    /**
     * 物联网卡号
     */
    private String iccid;
    /**
     * 物联网卡运营商
     */
    private Integer simType;
    /**
     * 发货日期
     */
    private String dateline;
    /**
     * 状态(0,已授权,1未授权,2未支付)
     */
    private Integer state;
    /**
     * 订单id
     */
    private String orderId;
    /**
     * 授权码
     */
    private String authorizationCode;
    /**
     * 物联网卡来源0-其他 1-官方
     */
    private Integer source;
    /**
     * 厂商名称|合作商名称
     */
    private String user;
    /**
     * imei
     */
    private String imei;

    private Integer validDays;
    private LocalDateTime expirationTime;
    /**
     *租户id
     */
    private Long tenantId;

}