package repository

import "ability/models"

type IUserRepository interface {
	GetUsersByMobile(mobile string) (v *models.Users, err error)
	GetUserInfoByMobile(mobile string) (v *models.UserInfo, err error)
	UpdateUserInfoById(m *models.UserInfo) (err error)
	GetUserInfoByAuthCode(authCode string) (v *models.UserInfo, err error)
	GetUserInfoByRefreshToken(refreshToken string) (v *models.UserInfo, err error)
}

func assertImplement() {
	var _ IUserRepository = (*UserRepository)(nil)
}

type UserRepository struct{}

func (r *UserRepository) GetUsersByMobile(mobile string) (v *models.Users, err error) {
	return models.GetUsersByMobile(mobile)
}

func (r *UserRepository) GetUserInfoByMobile(mobile string) (v *models.UserInfo, err error) {
	return models.GetUserInfoByMobile(mobile)
}

func (r *UserRepository) UpdateUserInfoById(m *models.UserInfo) (err error) {
	return models.UpdateUserInfoById(m)
}

func (r *UserRepository) GetUserInfoByAuthCode(authCode string) (v *models.UserInfo, err error) {
	return models.GetUserInfoByAuthCode(authCode)
}

func (r *UserRepository)GetUserInfoByRefreshToken(refreshToken string) (v *models.UserInfo, err error) {
	return models.GetUserInfoByRefreshToken(refreshToken)
}