package com.lingyue.auth.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.lingyue.common.domain.entity.SimpleModel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;

/**
 * 会话实体
 */
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("sessions")
@Schema(description = "会话实体")
public class Session extends SimpleModel {
    
    @Schema(description = "用户ID")
    @TableField("user_id")
    private String userId;
    
    @Schema(description = "Token哈希")
    @TableField("token_hash")
    private String tokenHash;
    
    @Schema(description = "刷新Token哈希")
    @TableField("refresh_token_hash")
    private String refreshTokenHash;
    
    @Schema(description = "过期时间")
    @TableField("expires_at")
    private Date expiresAt;
    
    @Schema(description = "IP地址")
    @TableField("ip_address")
    private String ipAddress;
    
    @Schema(description = "用户代理")
    @TableField("user_agent")
    private String userAgent;
    
    @Schema(description = "最后使用时间")
    @TableField("last_used_at")
    private Date lastUsedAt;
}
