package com.jeesharp.business.modules.member.entity;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.jeesharp.framework.mybatis.core.dataobject.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 会员第三方 OAuth 绑定
 *
 * @author jeesharp
 * @version 2026-03-19
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("app_member_oauth")
@Schema(description = "会员第三方OAuth绑定")
public class MemberOauth extends BaseEntity<MemberOauth> {

    @Schema(description = "会员ID")
    private String memberId;

    /**
     * @see com.jeesharp.business.modules.member.enums.OauthPlatformEnum
     */
    @Schema(description = "平台：WECHAT、HUAWEI、ALIPAY 等")
    private String platform;

    /**
     * @see com.jeesharp.business.modules.member.enums.OauthAppTypeEnum
     */
    @Schema(description = "应用类型：MINI、MP、APP、OPEN、ATOMIC")
    private String appType;

    @Schema(description = "应用 appId（请求头 X-App-Id；单应用可空串；与 JustAuth client-id 一致时可从服务端配置回退写入）")
    @TableField(value = "app_id", insertStrategy = FieldStrategy.ALWAYS, updateStrategy = FieldStrategy.ALWAYS)
    private String appId;

    @Schema(description = "OpenID")
    private String openid;

    @Schema(description = "UnionID")
    private String unionid;

    @Schema(description = "第三方用户ID（如支付宝 user_id）")
    private String thirdUserId;
}
