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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="src/GeoReport.fs" />
    <Compile Include="src/StopListGen.fs" />
    <Compile Include="src/HtmlPage.fs" />
    <Compile Include="Program.fs" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="../jrutil/jrutil.fsproj" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="FSharp.SystemTextJson" Version="1.2.42" />
    <PackageReference Include="giraffe" Version="6.3.0" />
  </ItemGroup>

  <Target Name="DownloadJsLibraries" BeforeTargets="Build">
    <DownloadFile
        SourceUrl="https://cdn.jsdelivr.net/npm/vue@3.3.4/dist/vue.global.prod.js"
        DestinationFolder="$(MSBuildProjectDirectory)/thirdparty"
        Condition="!Exists('$(MSBuildProjectDirectory)/thirdparty/vue.global.prod.js')"/>
    <DownloadFile
        SourceUrl="https://cdn.jsdelivr.net/npm/vue@3.3.4/dist/vue.global.js"
        DestinationFolder="$(MSBuildProjectDirectory)/thirdparty"
        Condition="!Exists('$(MSBuildProjectDirectory)/thirdparty/vue.global.js')"/>
    <DownloadFile
        SourceUrl="https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.css"
        DestinationFolder="$(MSBuildProjectDirectory)/thirdparty"
        Condition="!Exists('$(MSBuildProjectDirectory)/thirdparty/leaflet.css')"/>
    <DownloadFile
        SourceUrl="https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.js"
        DestinationFolder="$(MSBuildProjectDirectory)/thirdparty"
        Condition="!Exists('$(MSBuildProjectDirectory)/thirdparty/leaflet.js')"/>
  </Target>

</Project>
