package com.chinaweal.aiccs.org.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * OAuth访问令牌
 * </p>
 *
 * @author chinaweal
 * @since 2025-11-21
 */
@Data
@Accessors(chain = true)
@TableName(value = "oauth_access_token")
@ApiModel(description = "OAuth访问令牌")
public class OauthAccessToken implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 访问令牌
     */
    @ApiModelProperty(value = "访问令牌", example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...")
    @TableId(value = "token_id", type = IdType.ASSIGN_UUID)
    private String tokenId;

    /**
     * 访问令牌
     */
    @ApiModelProperty(value = "访问令牌", example = "access_token_12345")
    @TableField("access_token")
    private String accessToken;

    /**
     * 刷新令牌
     */
    @ApiModelProperty(value = "刷新令牌", example = "refresh_token_67890")
    @TableField("refresh_token")
    private String refreshToken;

    /**
     * 客户端ID
     */
    @ApiModelProperty(value = "客户端ID", example = "client123")
    @TableField("client_id")
    private String clientId;

    /**
     * 用户ID
     */
    @ApiModelProperty(value = "用户ID", example = "user456")
    @TableField("user_id")
    private String userId;

    /**
     * 用户名
     */
    @ApiModelProperty(value = "用户名", example = "john.doe")
    @TableField("user_name")
    private String userName;

    /**
     * 授权范围
     */
    @ApiModelProperty(value = "授权范围", example = "read write")
    @TableField("scope")
    private String scope;

    /**
     * 授权类型
     */
    @ApiModelProperty(value = "授权类型", example = "authorization_code")
    @TableField("grant_type")
    private String grantType;

    /**
     * 令牌过期时间
     */
    @ApiModelProperty(value = "令牌过期时间", example = "2025-11-22T10:30:00")
    @TableField("expires_in")
    private LocalDateTime expiresIn;

    /**
     * 刷新令牌过期时间
     */
    @ApiModelProperty(value = "刷新令牌过期时间", example = "2025-12-21T10:30:00")
    @TableField("refresh_expires_in")
    private LocalDateTime refreshExpiresIn;

    /**
     * 是否有效（0否1是）
     */
    @ApiModelProperty(value = "是否有效（0否1是）", example = "1")
    @TableField("is_active")
    private String isActive;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间", example = "2025-11-21T10:30:00")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @ApiModelProperty(value = "更新时间", example = "2025-11-21T15:45:00")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
}