<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>WinExe</OutputType>
        <TargetFramework>net9.0</TargetFramework>
        <Nullable>enable</Nullable>
        <BuiltInComInteropSupport>true</BuiltInComInteropSupport>
        <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
        <ApplicationManifest>app.manifest</ApplicationManifest>
        <AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
        <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    </PropertyGroup>

    <ItemGroup>
        <AvaloniaResource Include="Assets\**"/>
    </ItemGroup>

    <ItemGroup>
        <PackageReference Include="AsyncImageLoader.Avalonia" Version="3.3.0"/>
        <PackageReference Include="Avalonia" Version="11.2.1"/>
        <PackageReference Include="Avalonia.Desktop" Version="11.2.1"/>
        <PackageReference Include="Avalonia.Svg.Skia" Version="11.2.0.2" />
        <PackageReference Include="Avalonia.Themes.Fluent" Version="11.2.1"/>
        <PackageReference Include="Avalonia.Fonts.Inter" Version="11.2.1"/>
        <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
        <PackageReference Include="Avalonia.Diagnostics" Version="11.2.1">
            <IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
            <PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
        </PackageReference>
        <PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1"/>
        <PackageReference Include="Fluent.Net" Version="1.0.63" />
        <PackageReference Include="JetBrains.Annotations" Version="2024.3.0"/>
        <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0"/>
        <PackageReference Include="libsodium" Version="1.0.20"/>
    </ItemGroup>

    <ItemGroup>
        <Compile Update="Views\Tabs\ServerListTab.axaml.cs">
            <DependentUpon>ServerListTab.axaml</DependentUpon>
            <SubType>Code</SubType>
        </Compile>
        <Compile Update="Views\Popup\AddFavoriteView.axaml.cs">
          <DependentUpon>AddFavoriteView.axaml</DependentUpon>
          <SubType>Code</SubType>
        </Compile>
    </ItemGroup>

    <Target Name="BuildCheck" AfterTargets="AfterBuild">
        <Copy SourceFiles="..\Nebula.Runner\bin\$(Configuration)\$(TargetFramework)\Nebula.Runner.dll" DestinationFolder="$(OutDir)"/>
        <Copy SourceFiles="..\Nebula.Runner\bin\$(Configuration)\$(TargetFramework)\Nebula.Runner.pdb" DestinationFolder="$(OutDir)"/>
        <Copy SourceFiles="..\Nebula.Runner\bin\$(Configuration)\$(TargetFramework)\Nebula.Runner.deps.json" DestinationFolder="$(OutDir)"/>
        <Copy SourceFiles="..\Nebula.Runner\bin\$(Configuration)\$(TargetFramework)\Nebula.Runner.runtimeconfig.json" DestinationFolder="$(OutDir)"/>
    </Target>

    <Target Name="PublishCheck" AfterTargets="Publish">
        <Copy SourceFiles="..\Nebula.Runner\bin\$(Configuration)\$(TargetFramework)\Nebula.Runner.dll" DestinationFolder="$(PublishDir)"/>
        <Copy SourceFiles="..\Nebula.Runner\bin\$(Configuration)\$(TargetFramework)\Nebula.Runner.pdb" DestinationFolder="$(PublishDir)"/>
        <Copy SourceFiles="..\Nebula.Runner\bin\$(Configuration)\$(TargetFramework)\Nebula.Runner.deps.json" DestinationFolder="$(PublishDir)"/>
        <Copy SourceFiles="..\Nebula.Runner\bin\$(Configuration)\$(TargetFramework)\Nebula.Runner.runtimeconfig.json" DestinationFolder="$(PublishDir)"/>
    </Target>

    <ItemGroup>
        <ProjectReference Include="..\Nebula.Shared\Nebula.Shared.csproj"/>
        <ProjectReference Include="..\Nebula.SourceGenerators\Nebula.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
    </ItemGroup>
</Project>
