using Avalonia.Controls;
using CheckArticlesForSpam.Models;
using CheckArticlesForSpam.Views;
using ReactiveUI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace CheckArticlesForSpam.ViewModels
{

    public class RegistrationPageViewModel : ReactiveObject
    {
        MlgTeamContext teamContext;
        User newUser;
        string repeatInputPassword = "";
        string message = "";

        public RegistrationPageViewModel()
        {

        }
        public RegistrationPageViewModel(MlgTeamContext teamContext)
        {
            this.teamContext = teamContext;
            NewUser = new User();
        }

        public string RepeatInputPassword { get => repeatInputPassword; set => repeatInputPassword = value; }
        public string Message { get => message; set => this.RaiseAndSetIfChanged(ref message, value); }
        public User NewUser { get => newUser; set => newUser = value; }

        public User AddUserInDataBase()
        {
            teamContext.Add(NewUser);
            teamContext.SaveChanges();
            return NewUser;
        }
        public UserControl LoadPageAuthorization()
        {
            return new AuthorizationPage();
        }
    }
}
