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

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

  <ItemGroup>
    <Compile Include="src/Globals.fs" />
    <Compile Include="src/Utils.fs" />
    <Compile Include="src/Routes.fs" />
    <Compile Include="src/Trips.fs" />
    <Compile Include="src/Trip.fs" />
    <Compile Include="src/PublicApi.fs" />
    <Compile Include="Startup.fs" />
  </ItemGroup>

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

  <ItemGroup>
    <Watch Include="sass/*.sass" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="BigGustave" Version="1.0.6" />
    <PackageReference Include="Giraffe.ViewEngine" Version="1.4.0" />
  </ItemGroup>

  <Target Name="CompileSass" BeforeTargets="BeforeBuild">
    <Exec Command="sassc --sass sass/main.sass wwwroot/rtview.css" />
  </Target>

  <Target Name="DownloadJsLibraries" BeforeTargets="Build">
    <DownloadFile SourceUrl="https://cdn.jsdelivr.net/npm/chart.js@4.3.3/dist/chart.umd.js"
                  DestinationFolder="$(MSBuildProjectDirectory)/wwwroot"
                  Condition="!Exists('$(MSBuildProjectDirectory)/wwwroot/chart.umd.js')"/>
  </Target>

</Project>
