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

  <PropertyGroup>
    <AssemblyTitle>BGR.Console</AssemblyTitle>
    <Product>BGR.Console</Product>
    <Description>A command-line app for removing backgrounds from images.</Description>
    <Version>0.0.0</Version>
    <Authors>Stevan Freeborn</Authors>
    <PublishSingleFile>true</PublishSingleFile>
    <SelfContained>true</SelfContained>
    <PublishReadyToRun>true</PublishReadyToRun>
    <OutputType>Exe</OutputType>
  </PropertyGroup>

  <PropertyGroup>
    <DownloadDirectory>Resources/Files</DownloadDirectory>
  </PropertyGroup>

  <Target Name="DownloadModels" BeforeTargets="PrepareForBuild">
    <Message Text="Downloading models..." Importance="high" />

    <MakeDir Directories="$(DownloadDirectory)" Condition="!Exists('$(DownloadDirectory)')" />

    <Exec
      Condition="!Exists('$(DownloadDirectory)/rmbg.onnx')"
      Command="curl -L &quot;https://share.stevanfreeborn.com/bgr/rmbg.onnx&quot; -o &quot;$(DownloadDirectory)/rmbg.onnx&quot;"
    />

    <Exec
      Condition="!Exists('$(DownloadDirectory)/u2net.onnx')"
      Command="curl -L &quot;https://share.stevanfreeborn.com/bgr/u2net.onnx&quot; -o &quot;$(DownloadDirectory)/u2net.onnx&quot;"
    />

    <Exec
      Condition="!Exists('$(DownloadDirectory)/modnet.onnx')"
      Command="curl -L &quot;https://share.stevanfreeborn.com/bgr/modnet.onnx&quot; -o &quot;$(DownloadDirectory)/modnet.onnx&quot;"
    />

    <ItemGroup>
      <EmbeddedResource Include="Resources\Files\**\*" />
    </ItemGroup>
  </Target>

  <ItemGroup>
    <InternalsVisibleTo Include="$(AssemblyName).Tests" />
    <InternalsVisibleTo Include="DynamicProxyGenAssembly2" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.1" />
    <PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.1" />
    <PackageReference Include="Microsoft.Extensions.Options" Version="9.0.1" />
    <PackageReference Include="Microsoft.ML.OnnxRuntime" Version="1.20.1" />
    <PackageReference Include="Serilog" Version="4.2.0" />
    <PackageReference Include="Serilog.Extensions.Hosting" Version="9.0.0" />
    <PackageReference Include="Serilog.Formatting.Compact" Version="3.0.0" />
    <PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
    <PackageReference Include="SixLabors.ImageSharp" Version="3.1.6" />
    <PackageReference Include="Spectre.Console" Version="0.49.1" />
    <PackageReference Include="Spectre.Console.Cli" Version="0.49.1" />
  </ItemGroup>

</Project>
