package com.cico.nest.lcdp.boot.core.system.dal.dataobject.social;

import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cico.nest.lcdp.boot.api.system.enums.social.SocialTypeEnum;
import com.cico.nest.lcdp.framework.mybatis.core.dataobject.BaseDO;
import lombok.*;

/**
 * 社交（三方）用户
 *
 * @author zws
 */
@TableName(value = "system_social_user", autoResultMap = true)
@KeySequence("system_social_user_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库，可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SocialUserDO extends BaseDO {

    /**
     * 自增主键
     */
    @TableId
    private Long id;
    /**
     * 社交平台的类型
     *
     * 枚举 {@link SocialTypeEnum}
     */
    private Integer type;

    /**
     * 社交 openid
     */
    private String openid;
    /**
     * 社交 token
     */
    private String token;
    /**
     * 原始 Token 数据，一般是 JSON 格式
     */
    private String rawTokenInfo;

    /**
     * 用户昵称
     */
    private String nickname;
    /**
     * 用户头像
     */
    private String avatar;
    /**
     * 原始用户数据，一般是 JSON 格式
     */
    private String rawUserInfo;

    /**
     * 最后一次的认证 code
     */
    private String code;
    /**
     * 最后一次的认证 state
     */
    private String state;

    public SocialUserDO setId(Long id) {
        this.id = id;
        return this;
    }

    public SocialUserDO setType(Integer type) {
        this.type = type;
        return this;
    }

    public SocialUserDO setOpenid(String openid) {
        this.openid = openid;
        return this;
    }

    public SocialUserDO setToken(String token) {
        this.token = token;
        return this;
    }

    public SocialUserDO setRawTokenInfo(String rawTokenInfo) {
        this.rawTokenInfo = rawTokenInfo;
        return this;
    }

    public SocialUserDO setNickname(String nickname) {
        this.nickname = nickname;
        return this;
    }

    public SocialUserDO setAvatar(String avatar) {
        this.avatar = avatar;
        return this;
    }

    public SocialUserDO setRawUserInfo(String rawUserInfo) {
        this.rawUserInfo = rawUserInfo;
        return this;
    }

    public SocialUserDO setCode(String code) {
        this.code = code;
        return this;
    }

    public SocialUserDO setState(String state) {
        this.state = state;
        return this;
    }
}


