package model

type UserIPv6Subscription struct {
	ID               uint64 `gorm:"primaryKey;column:id" json:"id"`
	UserID           int    `gorm:"column:user_id;uniqueIndex:idx_user_ipv6_subscription_user" json:"user_id"`
	ShadowUserID     *int   `gorm:"column:shadow_user_id;index:idx_user_ipv6_subscription_shadow" json:"shadow_user_id"`
	IPv6Email        string `gorm:"column:ipv6_email;size:191" json:"ipv6_email"`
	Allowed          bool   `gorm:"column:allowed;default:false" json:"allowed"`
	Status           string `gorm:"column:status;size:32;index:idx_user_ipv6_subscription_status" json:"status"`
	LastSyncAt       int64  `gorm:"column:last_sync_at" json:"last_sync_at"`
	PasswordSyncedAt *int64 `gorm:"column:password_synced_at" json:"password_synced_at"`
	CreatedAt        int64  `gorm:"column:created_at" json:"created_at"`
	UpdatedAt        int64  `gorm:"column:updated_at" json:"updated_at"`

	User       User  `gorm:"foreignKey:UserID;references:ID" json:"user"`
	ShadowUser *User `gorm:"foreignKey:ShadowUserID;references:ID" json:"shadow_user"`
}

func (UserIPv6Subscription) TableName() string {
	return "v2_user_ipv6_subscriptions"
}
