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

    <!-- BepInEx Properties -->
    <PropertyGroup>
        <AssemblyName>Ratijas.HookahPlace</AssemblyName>
        <Product>HookahPlace</Product>
        <Version>4.2.0</Version>
    </PropertyGroup>
    <!-- Project Properties -->
    <PropertyGroup>
        <TargetFramework>netstandard2.1</TargetFramework>
        <RootNamespace>HookahPlace</RootNamespace>
        <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
        <LangVersion>latest</LangVersion>
    </PropertyGroup>

    <!-- Enable Nullable for better IDE null-checking -->
    <PropertyGroup>
        <Nullable>enable</Nullable>
    </PropertyGroup>

    <!-- Set NuGet Sources -->
    <PropertyGroup>
        <RestoreAdditionalProjectSources>
            https://api.nuget.org/v3/index.json;
            https://nuget.bepinex.dev/v3/index.json;
            https://nuget.windows10ce.com/nuget/v3/index.json <!-- This source lets you reference mods from thunderstore if they aren't on NuGet -->
        </RestoreAdditionalProjectSources>
    </PropertyGroup>

    <!-- Disable Publicizer Warnings -->
    <PropertyGroup>
        <NoWarn>$(NoWarn);CS0436</NoWarn>
    </PropertyGroup>

    <!-- Embed Debug Symbols for Easier Debugging -->
    <PropertyGroup>
        <DebugSymbols>true</DebugSymbols>
        <!-- NetcodePatch requires anything but 'full' -->
        <DebugType>embedded</DebugType>
    </PropertyGroup>
    <PropertyGroup Condition="$(Configuration) == 'Release'">
        <PathMap>$(UserProfile)=~,$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))=$(PackageId)/</PathMap>
    </PropertyGroup>

    <PropertyGroup>
        <DawnLibVersion>0.7.11</DawnLibVersion>
    </PropertyGroup>

    <!-- Primary Package References - BepInEx -->
    <ItemGroup>
        <PackageReference Include="BepInEx.Analyzers" Version="1.*" PrivateAssets="all"/>
        <PackageReference Include="BepInEx.AssemblyPublicizer.MSBuild" Version="0.4.1" PrivateAssets="all"/>
        <PackageReference Include="BepInEx.Core" Version="5.*" PrivateAssets="all"/>
        <PackageReference Include="BepInEx.PluginInfoProps" Version="2.*" PrivateAssets="all"/>
        <PackageReference Include="LethalCompany.GameLibs.Steam" Version="*-*" PrivateAssets="all"/>
        <PackageReference Include="Microsoft.Unity.Analyzers" Version="1.25.0">
            <PrivateAssets>all</PrivateAssets>
            <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
        </PackageReference>
        <PackageReference Include="UnityEngine.Modules" Version="2022.3.62" PrivateAssets="all"/>
        <PackageReference Include="TeamXiaolan.DawnLib" Version="$(DawnLibVersion)" PrivateAssets="all"/>
        <PackageReference Include="TeamXiaolan.DawnLib.DuskMod" Version="$(DawnLibVersion)" />
    </ItemGroup>

    <ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
        <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="all"/>
    </ItemGroup>

    <!-- Package References - Game Assembly HookGen -->
    <ItemGroup>
        <Reference Include="MMHOOK_Assembly-CSharp">
            <HintPath>$(MMHOOKDirectory)MMHOOK_Assembly-CSharp.dll</HintPath>
        </Reference>
    </ItemGroup>
    <!-- Netcode Patcher Post-Build Event -->
    <Sdk Name="Evaisa.NetcodePatcher.MSBuild" Version="4.4.1" />
    <ItemGroup>
        <NetcodePatch Include="$(TargetPath)" />
    </ItemGroup>

    <PropertyGroup>
        <NetcodePatcherUnityVersion>2022.3.62</NetcodePatcherUnityVersion>
        <NetcodePatcherNetcodeVersion>1.12.0</NetcodePatcherNetcodeVersion>
        <NetcodePatcherTransportVersion>1.0.0</NetcodePatcherTransportVersion>
    </PropertyGroup>

    <Target Name="PackThunderstore" DependsOnTargets="NetcodePatch" AfterTargets="PostBuildEvent" Condition="$(Configuration) == 'Release'">
        <Exec Command="tcli build --config-path &quot;$(ProjectDir)Thunderstore/thunderstore.toml&quot; --package-version $(Version) --package-name $(Product)"  />
    </Target>
</Project>
