using Books.E2E.Tests.Infrastructure;
using Microsoft.Playwright;

namespace Books.E2E.Tests.Actions;

/// <summary>
/// Shared context passed between Given/When/Then actions.
/// Stores references to Playwright and captured test data.
/// </summary>
public class ActionContext
{
    // Playwright
    public required IPage Page { get; init; }
    public required IBrowserContext BrowserContext { get; init; }

    // API access
    public required HttpClient ApiClient { get; init; }
    public required string BackendBaseUrl { get; init; }
    public required string FrontendBaseUrl { get; init; }

    // Configuration (for credentials etc.)
    public required E2EConfiguration Configuration { get; init; }

    // Test data captured during test execution
    public string? CompanyId { get; set; }
    public string? CompanyName { get; set; }
    public string? Cvr { get; set; }

    // Order test data
    public string? OrderId { get; set; }
    public string? OrderNumber { get; set; }
    public string? CustomerId { get; set; }
    public string? CustomerName { get; set; }

    // Invoice test data
    public string? InvoiceId { get; set; }
    public string? InvoiceNumber { get; set; }

    // Authentication state
    public string UserId { get; set; } = "e2e-test-user-001";
    public bool IsAuthenticated { get; set; }
}
