package models

import (
	"time"

	"git.apinb.com/bsm-sdk/core/database"
	"git.apinb.com/bsm-sdk/core/types"
	"gorm.io/gorm"
)

// 第三方登录配置表
type PassportProvider struct {
	gorm.Model
	types.Std_Passport
	ID           uint      `gorm:"primaryKey" json:"id"`
	Provider     string    `gorm:"type:varchar(20);index;not null" json:"provider"`     // google, twitter, facebook, wechat, apple, custom
	ProviderID   string    `gorm:"type:varchar(255);index;not null" json:"provider_id"` // 第三方平台的用户ID
	Email        string    `gorm:"type:varchar(100)" json:"email"`
	AccessToken  string    `gorm:"type:text" json:"-"`
	RefreshToken string    `gorm:"type:text" json:"-"`
	ExpiresAt    time.Time `json:"expires_at"`
}

func init() {
	database.AppendMigrate(&PassportProvider{})
}
