package repository

import "opp/models"

type IUserRepository interface {
	GetUsersById(uid int64) (v *models.User, err error)
	GetUsersByMobile(mobile string) (v *models.User, err error)
	UpdateUserInfo(m *models.User) (err error)
}

var _ IUserRepository = (*UserRepository)(nil)

type UserRepository struct{}

func (r *UserRepository) GetUsersById(uid int64) (v *models.User, err error) {
	return models.GetUsersById(uid)
}

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

func (r *UserRepository) UpdateUserInfo(m *models.User) (err error) {
	return models.UpdateUsersById(m)
}

type IUserCompanyRepository interface {
	GetUserCompanyByUserId(uid int64, companyId int64) (v *models.UserCompany, err error)
}

var _ IUserCompanyRepository = (*UserCompanyRepository)(nil)

type UserCompanyRepository struct{}

func (r *UserCompanyRepository) GetUserCompanyByUserId(uid int64, companyId int64) (v *models.UserCompany, err error) {
	return models.GetUserCompanyByUserId(uid, companyId)
}