<Project Sdk="Microsoft.NET.Sdk">

  <!--
    M1's definition of done, automated: a real DodoSSH API, a real PostgreSQL, a real Keycloak and a real
    sshd, driven by the real client from sign-in to an interactive shell.

    Nothing here is stubbed. Every other suite in the repository substitutes something — a stubbed identity
    provider, an in-memory vault server, an in-memory cache — and each of those substitutions is a place a
    misunderstanding of the protocol can hide on both sides at once. This suite exists to catch exactly
    that, and it already has: the realm file registered a loopback redirect URI that Keycloak rejects, and
    the API never applied the contract's JSON settings, which put the whole sync surface out of reach of
    the real client. No stub would have noticed either.

    It needs a Docker daemon and nothing else. See DevStack for what it starts and why.
  -->

  <ItemGroup>
    <ProjectReference Include="../../src/DodoSSH.Client.Session/DodoSSH.Client.Session.csproj" />
    <ProjectReference Include="../../src/DodoSSH.Client.Ssh/DodoSSH.Client.Ssh.csproj" />
    <ProjectReference Include="../../src/DodoSSH.Client.Terminal/DodoSSH.Client.Terminal.csproj" />

    <!-- Applies the committed migrations to the throwaway database, as `dotnet ef database update` would. -->
    <ProjectReference Include="../../src/DodoSSH.Infrastructure/DodoSSH.Infrastructure.csproj" />

    <!--
      Built but not linked. The API runs as a child process out of its own output directory so that it
      reads its own committed appsettings and executes its real entry point; referencing its assembly here
      would copy a DLL with no runtime configuration beside it and prove nothing. ReferenceOutputAssembly
      keeps the build dependency without the reference.
    -->
    <ProjectReference Include="../../src/DodoSSH.Api/DodoSSH.Api.csproj" ReferenceOutputAssembly="false" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Testcontainers" />
    <PackageReference Include="Testcontainers.PostgreSql" />
  </ItemGroup>

  <ItemGroup>
    <!--
      The realm the deployment ships, copied so the Keycloak container can be handed the real file rather
      than a fixture written to match it. A copy rather than a bind mount: Testcontainers hands the bytes
      to the daemon, which works the same whether the daemon is local, in a VM, or remote.
    -->
    <Content Include="../../deploy/keycloak/realm-dodossh.json"
             Link="realm-dodossh.json"
             CopyToOutputDirectory="PreserveNewest" />
  </ItemGroup>

  <!--
    Where the API's own build put it, asked of the API project rather than assembled from the bin layout.
    A changed output path then moves this with it instead of failing at run time with a path nobody wrote.
  -->
  <Target Name="DodoCaptureApiPath" BeforeTargets="GetAssemblyAttributes">
    <MSBuild Projects="../../src/DodoSSH.Api/DodoSSH.Api.csproj"
             Targets="GetTargetPath"
             Properties="Configuration=$(Configuration);TargetFramework=$(TargetFramework)">
      <Output TaskParameter="TargetOutputs" ItemName="DodoApiTarget" />
    </MSBuild>

    <ItemGroup>
      <AssemblyMetadata Include="DodoSSH.ApiAssemblyPath" Value="@(DodoApiTarget)" />
    </ItemGroup>
  </Target>

</Project>
