using Models;
using ShoopNCook.Controllers;

namespace ShoopNCook.Pages;

public partial class MorePage : ContentPage
{

    private readonly MorePageController controller;

	public MorePage(Account account, MorePageController controller)
	{
        InitializeComponent();
		ProfileImage.Source = ImageSource.FromUri(account.User.ProfilePicture);
		ProfileName.Text = account.User.Name;
        this.controller = controller;
    }

    private void OnMyRecipesButtonTapped(object sender, EventArgs e)
    {
        controller.GoToMyRecipesPage();
    }
    
    private void OnEditProfileButtonTapped(object sender, EventArgs e)
    {
        controller.GoToProfilePage();
    }
    
    private void OnLogoutButtonTapped(object sender, EventArgs e)
    {
        controller.Logout();
    }
    private async void OnShareButtonClicked(object sender, EventArgs e)
    {
        await Share.RequestAsync(new ShareTextRequest
        {
            Text = "Voici le texte à partager (à changer)",
            Title = "Partagez ce texte : (à modifier)"
        });
    }
}