public IActionResult ResendConfirmCode([FromBody] ResendConfirmCodeRequest request)
        {
            var user = UserService.Get(request.UserID);

            if (user == null)
            {
                return(NotFound(new ResponseModel
                {
                    Success = false,
                    Message = "Пользователь не найден"
                }));
            }

            var session = UserSessionService.GetUserActiveSession(user);

            if (session == null)
            {
                return(NotFound(new ResponseModel
                {
                    Success = false,
                    Message = "Сессия не найдена"
                }));
            }

            UserSessionService.CloseUserActiveSession(user);
            session = UserSessionService.CreateSession(user);

            SmscHelper.SendSms(user.PhoneNumber, $"Код для входа: {session.AuthCode}");

            return(Ok(new SignInResponse
            {
                UserID = user.ID
            }));
        }
        public IActionResult SignIn([FromBody] SignInRequest request)
        {
            var user = UserService.FindByPhoneNumber(request.PhoneNumber);

            if (user == null)
            {
                return(NotFound(new ResponseModel
                {
                    Success = false,
                    Message = "Номер телефона не зарегистрирован"
                }));
            }

            if (UserSessionService.GetUserActiveSession(user) != null)
            {
                UserSessionService.CloseUserActiveSession(user);
            }

            var session = UserSessionService.CreateSession(user);

            SmscHelper.SendSms(user.PhoneNumber, $"Код для входа: {session.AuthCode}");

            return(Ok(new SignInResponse
            {
                UserID = user.ID
            }));
        }
        public IActionResult SignInConfirm([FromBody] SignInConfirmRequest request)
        {
            var user = UserService.Get(request.UserID);

            if (user == null)
            {
                return(NotFound(new ResponseModel
                {
                    Success = false,
                    Message = "Пользователь не найден"
                }));
            }

            var session = UserSessionService.GetUserActiveSession(user);

            if (session == null)
            {
                return(NotFound(new ResponseModel
                {
                    Success = false,
                    Message = "Сессия не найдена"
                }));
            }

            if (request.Code != session.AuthCode)
            {
                return(BadRequest(new ResponseModel
                {
                    Success = false,
                    Message = "Неверный код подтверждения"
                }));
            }

            var token = UserSessionService.AuthorizeUser(user);

            return(Ok(new SignInConfirmResponse
            {
                Token = token,
                Role = user.Role
            }));
        }