package com.gxwebsoft.app.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableLogic;
import java.io.Serializable;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 应用密钥凭证
 *
 * @author 科技小王子
 * @since 2026-03-28 21:29:43
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Schema(name = "AppCredential对象", description = "应用密钥凭证")
public class AppCredential implements Serializable {
    private static final long serialVersionUID = 1L;

    @Schema(description = "自增ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @Schema(description = "关联应用ID")
    private Long websiteId;

    @Schema(description = "凭证名称，如生产环境密钥")
    private String name;

    @Schema(description = "App ID（公开）")
    private String appId;

    @Schema(description = "App Secret（加密存储）")
    private String appSecret;

    @Schema(description = "凭证类型: server/client/webhook")
    private String type;

    @Schema(description = "权限范围，空格分隔")
    private String scopes;

    @Schema(description = "到期时间，NULL=永不过期")
    private LocalDateTime expireTime;

    @Schema(description = "最后使用时间")
    private LocalDateTime lastUsedAt;

    private String remark;

    @Schema(description = "排序(数字越小越靠前)")
    private Integer sortNumber;

    @Schema(description = "状态, 0正常, 1冻结")
    private Integer status;

    @Schema(description = "是否删除, 0否, 1是")
    @TableLogic
    private Integer deleted;

    @Schema(description = "用户ID")
    private Integer userId;

    @Schema(description = "租户id")
    private Integer tenantId;

    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @Schema(description = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

}
