package module

import (
	"gitlab.alibaba-inc.com/pai_biz_arch/pairec/context"
	"gitlab.alibaba-inc.com/pai_biz_arch/pairec/recconf"
)

type UserCollaborativeDao interface {
	ListItemsByUser(user *User, context *context.RecommendContext) []*Item
}

func NewUserCollaborativeDao(config recconf.RecallConfig) UserCollaborativeDao {
	if config.UserCollaborativeDaoConf.AdapterType == recconf.DaoConf_Adapter_Mysql {
		if config.UserCollaborativeDaoConf.Adapter == "UserCollaborativeMysqlDao" {
			return NewUserCollaborativeMysqlDao(config)
		} else if config.UserCollaborativeDaoConf.Adapter == "UserVideoCollaborativeMysqlDao" {
			return NewUserVideoCollaborativeMysqlDao(config)
		}
	} else if config.UserCollaborativeDaoConf.AdapterType == recconf.DaoConf_Adapter_TableStore {
		return NewUserCollaborativeTableStoreDao(config)
	} else if config.UserCollaborativeDaoConf.AdapterType == recconf.DaoConf_Adapter_Hologres {
		return NewUserCollaborativeHologresDao(config)
	}

	panic("not found UserCollaborativeDao implement")
}
