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

  <ItemGroup>
    <ProjectReference Include="..\QuantEngine.Infrastructure\QuantEngine.Infrastructure.csproj" />
    <ProjectReference Include="..\QuantEngine.Application\QuantEngine.Application.csproj" />
    <ProjectReference Include="..\QuantEngine.Core\QuantEngine.Core.csproj" />
    <ProjectReference Include="Client\QuantEngine.Web.Client.csproj" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="MudBlazor" Version="8.6.0" />
    <PackageReference Include="Serilog.AspNetCore" Version="10.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="10.0.0-preview.2.25120.18" />
  </ItemGroup>

  <ItemGroup>
    <!-- Exclude client project files from server build to avoid duplicate compilations -->
    <Compile Remove="Client\**" />
    <Content Remove="Client\**" />
    <EmbeddedResource Remove="Client\**" />
    <None Remove="Client\**" />
  </ItemGroup>

  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <BlazorDisableThrowNavigationException>true</BlazorDisableThrowNavigationException>
  </PropertyGroup>

  <!-- Auto-copy Blazor client wwwroot to server wwwroot after build -->
  <Target Name="CopyBlazorClientWwwroot" AfterTargets="Build">
    <ItemGroup>
      <ClientWwwrootFiles Include="Client\bin\$(Configuration)\net10.0\wwwroot\**\*" />
    </ItemGroup>
    <Copy SourceFiles="@(ClientWwwrootFiles)" DestinationFiles="@(ClientWwwrootFiles->'wwwroot\%(RecursiveDir)%(Filename)%(Extension)')" />
    <Message Text="✅ Copied Blazor client wwwroot to server wwwroot" Importance="high" />
  </Target>

</Project>
