using FluentAssertions;

namespace SatelliteProvider.Tests;

public class AcceptanceCriteriaRT2Tests
{
    [Fact]
    public void RT2_LinesAllFourPointTypes_AZ370_AC3()
    {
        var path = LocateAcceptanceCriteriaMd();
        if (path is null)
        {
            Assert.Fail("acceptance_criteria.md not found from test runtime — repo layout drift");
        }

        var content = File.ReadAllText(path);
        var rt2Line = content.Split('\n').FirstOrDefault(line => line.Contains("| RT2 |"));

        rt2Line.Should().NotBeNull("RT2 row must exist in the Route Management section");
        rt2Line!.Should().Contain("\"start\"");
        rt2Line.Should().Contain("\"end\"");
        rt2Line.Should().Contain("\"action\"");
        rt2Line.Should().Contain("\"intermediate\"");
    }

    private static string? LocateAcceptanceCriteriaMd()
    {
        var dir = new DirectoryInfo(Directory.GetCurrentDirectory());
        while (dir is not null)
        {
            var candidate = Path.Combine(dir.FullName, "_docs", "00_problem", "acceptance_criteria.md");
            if (File.Exists(candidate))
            {
                return candidate;
            }
            dir = dir.Parent;
        }
        return null;
    }
}
