package model

const (
	AuthBindStatusNormal   = 1
	AuthBindStatusDisabled = 2
)

const (
	AdminName = "jxadmin"

	AuthBindTypeAll  = -1
	AuthBindTypeAuth = 0 // 绑定类型为认证
	AuthBindTypeID   = 1 // 绑定类型为用户标识，不做为认证
)

type AuthBind struct {
	ModelIDCULD

	AuthID   string `orm:"size(48);column(auth_id)" json:"authID"`
	BindType int8   `json:"bindType"`
	Type     string `orm:"size(16)" json:"type"`

	TypeID      string `orm:"size(32);column(type_id)" json:"typeID"`
	UserID      string `orm:"size(48);column(user_id);index" json:"userID"`
	Status      int8   `json:"status"`
	AuthID2     string `orm:"size(48);column(auth_id2);index" json:"authID2"`
	AuthSecret  string `orm:"size(48)" json:"-"`
	AuthSecret2 string `orm:"size(48)" json:"-"`
	Remark      string `orm:"size(255)" json:"remark"`
	DetailData  string `orm:"type(text)" json:"detailData"`
}

func (*AuthBind) TableUnique() [][]string {
	return [][]string{
		// []string{"UserID", "Type", "DeletedAt"}, // 这个其实UserID是属性，而不是key
		[]string{"AuthID", "Type", "BindType", "DeletedAt"},
	}
}
