package service

import (
	"github.com/zs/InsightReply/internal/model"
	"github.com/zs/InsightReply/internal/repository"
)

type UserService struct {
	repo *repository.UserRepository
}

func NewUserService(repo *repository.UserRepository) *UserService {
	return &UserService{repo: repo}
}

func (s *UserService) Register(email string, identity string) (*model.User, error) {
	user := &model.User{
		Email:         email,
		IdentityLabel: identity,
	}
	err := s.repo.Create(user)
	return user, err
}

func (s *UserService) GetUser(email string) (*model.User, error) {
	return s.repo.GetByEmail(email)
}
