using Tests.Pages.BuildCalculator;
using Tests.Shared;

namespace Tests.Pages;

public class BuildCalculatorPage : BasePage
{
    public BuildCalculatorPage(Website website) : base(website)
    {
        Timing = new TimingComponent(website);
        Filter = new FilterComponent(website);
        Options = new OptionsComponent(website);
        Bank = new BankComponent(website);
        Army = new ArmyComponent(website);
        Highlights = new HighlightsComponent(website);
        BuildOrder = new BuildOrderComponent(website);
        Timeline = new TimelineComponent(website);
        Hotkeys = new HotkeyViewerComponent(website);
        EntityView = new EntityClickViewComponent(website);
        Chart = new BuildChartComponent(website);
        Toast = new ToastComponent(website);
    }

    public override string Url => "build-calculator";

    public TimingComponent Timing { get; }
    public FilterComponent Filter { get; }
    public OptionsComponent Options { get; }
    public BankComponent Bank { get; }
    public ArmyComponent Army { get; }
    public HighlightsComponent Highlights { get; }
    public BuildOrderComponent BuildOrder { get; }
    public TimelineComponent Timeline { get; }
    public HotkeyViewerComponent Hotkeys { get; }
    public EntityClickViewComponent EntityView { get; }
    public BuildChartComponent Chart { get; }
    public ToastComponent Toast { get; }

    public ILocator CalculatorGrid => Website.Locator(".calculatorGrid");

    public ILocator ClearBuildOrderButton =>
        Website.Locator("button").Filter(new LocatorFilterOptions { HasText = "Clear Build Order" });

    public async Task ClickClearBuildOrderAsync()
    {
        await ClearBuildOrderButton.ClickAsync();
    }
}