package auth

import (
	"context"
	"server/internal/model"
	"server/internal/service"

	v1 "server/api/auth/v1"
)

func (c *ControllerV1) UserLogin(ctx context.Context, req *v1.UserLoginReq) (res *v1.UserLoginRes, err error) {
	out, err := service.User().Login(ctx, &model.UserLoginIn{Email: req.Email, Password: req.Password})
	if err != nil {
		return nil, err
	}

	return &v1.UserLoginRes{Token: out.Token}, nil
}
