diff --git a/src/Forbury.Integrations/API/v1/Clients/Model/ForburyModelRetailApiClient.cs b/src/Forbury.Integrations/API/v1/Clients/Model/ForburyModelRetailApiClient.cs new file mode 100644 index 0000000..604f470 --- /dev/null +++ b/src/Forbury.Integrations/API/v1/Clients/Model/ForburyModelRetailApiClient.cs @@ -0,0 +1,36 @@ +using Forbury.Integrations.API.Models.Configuration; +using Forbury.Integrations.API.v1.Dto.Model; +using Forbury.Integrations.API.v1.Interfaces.Model; +using Microsoft.AspNetCore.Http.Extensions; +using Microsoft.Extensions.Options; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using Forbury.Integrations.API.v1.Dto.Model.Retail.Input; + +namespace Forbury.Integrations.API.v1.Clients.Model +{ + public class ForburyModelRetailApiClient : ForburyModelApiClient, IForburyModelRetaillApiClient + { + public ForburyModelRetailApiClient(HttpClient httpClient, + IOptions configuration) : + base(httpClient, configuration) + { } + + public async Task CreateModel(RetailValuationInputDto data, + string googlePropertyId, + int? teamId, + string externalId = null, + string fullAddress = null, + CancellationToken cancellationToken = default) + { + QueryBuilder queryBuilder = new QueryBuilder(); + if (!string.IsNullOrEmpty(googlePropertyId)) queryBuilder.Add("googlePropertyId", googlePropertyId); + if (teamId.HasValue) queryBuilder.Add("teamId", teamId.ToString()); + if (!string.IsNullOrEmpty(externalId)) queryBuilder.Add("externalId", externalId); + if (!string.IsNullOrEmpty(fullAddress)) queryBuilder.Add("fullAddress", fullAddress); + + return await PostAsync($"retail/{queryBuilder.ToQueryString()}", data, cancellationToken); + } + } +} diff --git a/src/Forbury.Integrations/API/v1/Dto/Model/Commercial/Input/Space/SpaceDto.cs b/src/Forbury.Integrations/API/v1/Dto/Model/Commercial/Input/Space/SpaceDto.cs index 7f26c8f..1a26343 100644 --- a/src/Forbury.Integrations/API/v1/Dto/Model/Commercial/Input/Space/SpaceDto.cs +++ b/src/Forbury.Integrations/API/v1/Dto/Model/Commercial/Input/Space/SpaceDto.cs @@ -20,6 +20,11 @@ public class SpaceDto public LeaseDto Lease { get; set; } public FirstRenewalDto FirstRenewal { get; set; } public MarketAssumptionDto MarketAssumption { get; set; } + + /// + /// Equivalent to growth/renewal type for each space, + /// It should exist in the future.renewalAssumptions, otherwise ignored + /// public string RenewalAssumptionName { get; set; } } } diff --git a/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Enums/CarLevyType.cs b/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Enums/CarLevyType.cs new file mode 100644 index 0000000..7b264ae --- /dev/null +++ b/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Enums/CarLevyType.cs @@ -0,0 +1,9 @@ +namespace Forbury.Integrations.API.v1.Dto.Model.Retail.Input.Enums +{ + public enum CarLevyType + { + None, + Leasee, + Leaseor + } +} \ No newline at end of file diff --git a/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Enums/RecoveryLeaseType.cs b/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Enums/RecoveryLeaseType.cs new file mode 100644 index 0000000..db498bd --- /dev/null +++ b/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Enums/RecoveryLeaseType.cs @@ -0,0 +1,10 @@ +namespace Forbury.Integrations.API.v1.Dto.Model.Retail.Input.Enums +{ + public enum RecoveryLeaseType + { + Net, + Gross, + SemiGross, + IncreaseOverBase + } +} \ No newline at end of file diff --git a/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Future/RetailFuturesDto.cs b/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Future/RetailFuturesDto.cs new file mode 100644 index 0000000..4a1071f --- /dev/null +++ b/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Future/RetailFuturesDto.cs @@ -0,0 +1,10 @@ +using Forbury.Integrations.API.v1.Dto.Model.Commercial.Input.Future; +using System.Collections.Generic; + +namespace Forbury.Integrations.API.v1.Dto.Model.Retail.Input.Future +{ + public class RetailFuturesDto: FuturesDto + { + public new List RenewalAssumptions { get; set; } + } +} diff --git a/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Future/RetailRenewalAssumptionDto.cs b/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Future/RetailRenewalAssumptionDto.cs new file mode 100644 index 0000000..0f0926c --- /dev/null +++ b/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Future/RetailRenewalAssumptionDto.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using Forbury.Integrations.API.v1.Dto.Model.Commercial.Input.Future; + +namespace Forbury.Integrations.API.v1.Dto.Model.Retail.Input.Future +{ + public class RetailRenewalAssumptionDto: RenewalAssumptionDto + { + /// + /// Default Market Growth Rate for MAT & Rent + /// + public decimal? DefaultMarketGrowthRate { get; set; } + + /// + /// Moving Annual Turnover Growth Rates by years (up to 20 years) + /// + public List MatGrowthRates { get; set; } + + /// + /// Number of months of incentive for renewing lease + /// + public decimal? IncentiveRenewingMonths { get; set; } + + /// + /// Number of months of incentive for new lease + /// + public decimal? IncentiveNewLeaseMonths { get; set; } + } +} diff --git a/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/General/RetailGeneralDto.cs b/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/General/RetailGeneralDto.cs new file mode 100644 index 0000000..94cf6b7 --- /dev/null +++ b/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/General/RetailGeneralDto.cs @@ -0,0 +1,12 @@ +using Forbury.Integrations.API.v1.Dto.Model.Retail.Input.Space.Lease.MovingAnnualTurnover; + +namespace Forbury.Integrations.API.v1.Dto.Model.Retail.Input.General +{ + public class RetailGeneralDto: Commercial.Input.General.GeneralDto + { + /// + /// Property level Moving Annual Turnover setting + /// + public MovingAnnualTurnoverDto MAT { get; set; } + } +} diff --git a/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/GeneralLedger/GeneralLedgerDto.cs b/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/GeneralLedger/GeneralLedgerDto.cs new file mode 100644 index 0000000..34a6ba3 --- /dev/null +++ b/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/GeneralLedger/GeneralLedgerDto.cs @@ -0,0 +1,8 @@ +namespace Forbury.Integrations.API.v1.Dto.Model.Retail.Input.GeneralLedger +{ + public class GeneralLedgerDto + { + public string Code { get; set; } + public string Description { get; set; } + } +} diff --git a/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/RetailValuationInputDto.cs b/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/RetailValuationInputDto.cs new file mode 100644 index 0000000..b2ac808 --- /dev/null +++ b/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/RetailValuationInputDto.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using Forbury.Integrations.API.v1.Dto.Model.Commercial.Input; +using Forbury.Integrations.API.v1.Dto.Model.Retail.Input.Future; +using Forbury.Integrations.API.v1.Dto.Model.Retail.Input.General; +using Forbury.Integrations.API.v1.Dto.Model.Retail.Input.GeneralLedger; +using Forbury.Integrations.API.v1.Dto.Model.Retail.Input.Space; + +namespace Forbury.Integrations.API.v1.Dto.Model.Retail.Input +{ + public class RetailValuationInputDto : ValuationInputDto + { + public new RetailGeneralDto General { get; set; } + public new List Spaces { get; set; } + public new RetailFuturesDto Futures { get; set; } + + public List GeneralLedgers { get; set; } + } +} diff --git a/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Space/Lease/MovingAnnualTurnover/MovingAnnualTurnoverDto.cs b/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Space/Lease/MovingAnnualTurnover/MovingAnnualTurnoverDto.cs new file mode 100644 index 0000000..fa483da --- /dev/null +++ b/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Space/Lease/MovingAnnualTurnover/MovingAnnualTurnoverDto.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Forbury.Integrations.API.v1.Dto.Model.Retail.Input.Space.Lease.MovingAnnualTurnover +{ + public class MovingAnnualTurnoverDto + { + /// + /// True - GST Inclusive or False - Exclusive + /// + public bool Prior12MonthsGstInclusive { get; set; } + + /// + /// True - GST Inclusive or False - Exclusive + /// + public bool Last12MonthsGstInclusive { get; set; } + } +} diff --git a/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Space/Lease/PercentageRent/PercentageRentDto.cs b/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Space/Lease/PercentageRent/PercentageRentDto.cs new file mode 100644 index 0000000..1ea79d1 --- /dev/null +++ b/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Space/Lease/PercentageRent/PercentageRentDto.cs @@ -0,0 +1,28 @@ +using Newtonsoft.Json.Converters; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; + +namespace Forbury.Integrations.API.v1.Dto.Model.Retail.Input.Space.Lease.PercentageRent +{ + public class PercentageRentDto + { + /// + /// The type of percentage rent (supported input - "N" for natural, "U" for unnatural) + /// + public string Type { get; set; } + + /// + /// The percentage for natural breakeven + /// + public decimal? Percentage { get; set; } + + /// + /// Type of input for natural breakeven ("Base", "Base+Rec", "Promo") + /// + public string Basis { get; set; } + } +} diff --git a/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Space/Lease/RetailLeaseDto.cs b/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Space/Lease/RetailLeaseDto.cs new file mode 100644 index 0000000..c4f47c5 --- /dev/null +++ b/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Space/Lease/RetailLeaseDto.cs @@ -0,0 +1,45 @@ +using Forbury.Integrations.API.v1.Dto.Model.Commercial.Input.Space.Renewal; +using Forbury.Integrations.API.v1.Dto.Model.Retail.Input.Space.Lease.PercentageRent; + +namespace Forbury.Integrations.API.v1.Dto.Model.Retail.Input.Space.Lease +{ + public class RetailLeaseDto: Commercial.Input.Space.Lease.LeaseDto + { + /// + /// The MAT amount prior 12 months (GST inclusive/exclusive based on General.MAT.Prior12MonthsGstInclusive) + /// + public decimal? MATPrior12Months { get; set; } + + /// + /// The MAT amount last 12 months (GST inclusive/exclusive based on General.MAT.Prior12MonthsGstInclusive) + /// + public decimal? MATLast12Months { get; set; } + + /// + /// Provide up to 3 future options periods in years + /// + public new int[] Options { get; set; } + + /// + /// The selected option index (0, 1, 2) zero based index, translated into 1, 2, 3 for the model. + /// + public int? AdoptedOption { get; set; } + + /// + /// GOC Cap deal until first review + /// + public decimal? GocCap { get; set; } + + /// + /// Review frequency in years + /// + public int? DefaultReviewFrequency { get; set; } + + /// + /// Review type (e.g. Fixed % such as 2.5%, CPI, CPI+1.25, %RentAvg2Y, GOC8.5%) + /// + public string DefaultReviewType { get; set; } + + public PercentageRentDto PercentageRent { get; set; } + } +} diff --git a/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Space/RetailSpaceDto.cs b/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Space/RetailSpaceDto.cs new file mode 100644 index 0000000..72bf06f --- /dev/null +++ b/src/Forbury.Integrations/API/v1/Dto/Model/Retail/Input/Space/RetailSpaceDto.cs @@ -0,0 +1,15 @@ + +using Forbury.Integrations.API.v1.Dto.Model.Retail.Input.Space.Lease; + +namespace Forbury.Integrations.API.v1.Dto.Model.Retail.Input.Space +{ + public class RetailSpaceDto: Commercial.Input.Space.SpaceDto + { + /*** + * General Ledger code used to lookup on General Ledger list provided + */ + public string GeneralLedgerCode { get; set; } + + public new RetailLeaseDto Lease { get; set; } + } +} diff --git a/src/Forbury.Integrations/API/v1/Interfaces/Model/IForburyModelRetailApiClient.cs b/src/Forbury.Integrations/API/v1/Interfaces/Model/IForburyModelRetailApiClient.cs new file mode 100644 index 0000000..56cad2d --- /dev/null +++ b/src/Forbury.Integrations/API/v1/Interfaces/Model/IForburyModelRetailApiClient.cs @@ -0,0 +1,17 @@ +using System.Threading; +using System.Threading.Tasks; +using Forbury.Integrations.API.v1.Dto.Model; +using Forbury.Integrations.API.v1.Dto.Model.Retail.Input; + +namespace Forbury.Integrations.API.v1.Interfaces.Model +{ + public interface IForburyModelRetaillApiClient : IForburyModelApiClient + { + Task CreateModel(RetailValuationInputDto data, + string googlePropertyId, + int? teamId, + string externalId = null, + string fullAddress = null, + CancellationToken cancellationToken = default); + } +} diff --git a/src/Forbury.Integrations/API/v1/ServiceBuilder.cs b/src/Forbury.Integrations/API/v1/ServiceBuilder.cs index 7f1681c..5e27c0c 100644 --- a/src/Forbury.Integrations/API/v1/ServiceBuilder.cs +++ b/src/Forbury.Integrations/API/v1/ServiceBuilder.cs @@ -13,6 +13,7 @@ internal static void AddForburyServices(IServiceCollection services, string uriP services.AddForburyHttpClient(uriPrefix, "model"); services.AddForburyHttpClient(uriPrefix, "model"); services.AddForburyHttpClient(uriPrefix, "model"); + services.AddForburyHttpClient(uriPrefix, "model"); services.AddForburyHttpClient(uriPrefix, "product"); services.AddForburyHttpClient(uriPrefix, "property"); services.AddForburyHttpClient(uriPrefix, "team"); diff --git a/src/Forbury.Integrations/Forbury.Integrations.csproj b/src/Forbury.Integrations/Forbury.Integrations.csproj index 1174917..4bd8a49 100644 --- a/src/Forbury.Integrations/Forbury.Integrations.csproj +++ b/src/Forbury.Integrations/Forbury.Integrations.csproj @@ -44,4 +44,9 @@ + + + + +