using Microsoft.AspNetCore.Components;

namespace UI_MAUI.Components;

public partial class Assistant : ComponentBase
{
    [Parameter]
    public string HeaderText { get; set; } = string.Empty;
    
    [Parameter]
    public string Name { get; set; } = "Assistant";

    [Parameter]
    public string IconName { get; set; } = string.Empty;

    [Parameter]
    public Height BaseHeight { get; set; } = new(60, 40, 50);

    public readonly record struct Height(int Phone, int Desktop, int Tablet);
    
    [Parameter]
    public RenderFragment ChildContent { get; set; }
    
    private string AssistantHeight =>
        DeviceInfo.Idiom == DeviceIdiom.Phone ? $"--bs-offcanvas-height: {this.BaseHeight.Phone}vh;" :
        DeviceInfo.Idiom == DeviceIdiom.Tablet ? $"--bs-offcanvas-height: {this.BaseHeight.Tablet}vh;" :
        $"--bs-offcanvas-height: {this.BaseHeight.Desktop}vh;";

    private string HeaderIconAltText => $"Icon: {this.HeaderText}";
    
    private bool IsIconAvailable => !string.IsNullOrWhiteSpace(this.IconName);
}