package com.chinaweal.aiccs.org.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.chinaweal.aiccs.common.util.DateUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.apache.ibatis.type.JdbcType;

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

import static com.chinaweal.youfool.framework.springboot.util.ConstantsUtil.*;

/**
 * <p>
 * OAuth登录的客户端登记信息
 * </p>
 *
 * @author chinaweal
 * @since 2025-11-21
 */
@Data
@Accessors(chain = true)
@TableName(value = "oauth_client")
@ApiModel(description = "OAuth登录的客户端登记信息")
public class OauthClient implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 客户端id
     */
    @ApiModelProperty(value = "客户端id", example = "client123")
    @TableId(value = "client_id", type = IdType.ASSIGN_UUID)
    private String clientId;

    /**
     * 客户端秘钥
     */
    @ApiModelProperty(value = "客户端秘钥", example = "secret-key-abc123")
    @TableField("client_secret")
    private String clientSecret;

    /**
     * 客户端名称
     */
    @ApiModelProperty(value = "客户端名称", example = "Web Application")
    @TableField("client_name")
    private String clientName;

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

    /**
     * 创建人
     */
    @ApiModelProperty(value = "创建人")
    @TableField(value = "create_by", fill = FieldFill.INSERT, jdbcType = JdbcType.VARCHAR)
    private String createBy;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    @JsonFormat(pattern = DateUtils.DATETIME_DEFAULT_FORMAT, timezone = "GMT+8")
    private LocalDateTime createTime;

    /**
     * 更新人
     */
    @ApiModelProperty(value = "更新人")
    @TableField(value = "update_by", fill = FieldFill.INSERT_UPDATE, jdbcType = JdbcType.VARCHAR)
    private String updateBy;

    /**
     * 更新时间
     */
    @ApiModelProperty(value = "更新时间")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = DateUtils.DATETIME_DEFAULT_FORMAT, timezone = "GMT+8")
    private LocalDateTime updateTime;
}