Files
AdPlatform-Server/IntelligenceApi/Models/DemographicsModels.cs
2026-03-14 13:50:09 -07:00

76 lines
3.3 KiB
C#

namespace IntelligenceApi.Models;
// ════════════════════════════════════════════════
// Request: Gateway → IntelligenceApi
// Gateway sends raw census data fetched from DB,
// plus the ZCTA for context.
// ════════════════════════════════════════════════
public sealed class DemographicAnalysisRequest
{
/// <summary>5-digit ZIP code / ZCTA</summary>
public string Zcta { get; set; } = string.Empty;
/// <summary>
/// Raw census row from spDemographics.
/// All numeric fields; nulls treated as zero.
/// </summary>
public CensusData Census { get; set; } = new();
}
public sealed class CensusData
{
public int TotalPopulation { get; set; }
public int TotalHouseholds { get; set; }
public int MedianIncome { get; set; }
public int MedianHomeValue { get; set; }
public decimal Pct18to24 { get; set; }
public decimal Pct25to34 { get; set; }
public decimal Pct35to44 { get; set; }
public decimal Pct45to54 { get; set; }
public decimal Pct55to64 { get; set; }
public decimal Pct65plus { get; set; }
public decimal PctBachelorPlus { get; set; }
public decimal PctOwnerOccupied { get; set; }
public decimal PctRenterOccupied { get; set; }
public decimal PctFamilyHouseholds { get; set; }
public decimal PctLivingAlone { get; set; }
public decimal PctHispanic { get; set; }
public decimal PctAsian { get; set; }
public decimal PctBlack { get; set; }
public decimal PctRemoteWork { get; set; }
public decimal PctPublicTransit { get; set; }
public decimal UnemploymentRate { get; set; }
public decimal PctIncomeUnder30k { get; set; }
public decimal PctIncome30kTo75k { get; set; }
public decimal PctIncome75kTo150k { get; set; }
public decimal PctIncome150kPlus { get; set; }
}
// ════════════════════════════════════════════════
// Response: IntelligenceApi → Gateway → Client
// ════════════════════════════════════════════════
public sealed class DemographicAnalysisResponse
{
public bool Ok { get; set; } = true;
public string Zcta { get; set; } = string.Empty;
/// <summary>Raw census metrics passed through for display</summary>
public CensusData Census { get; set; } = new();
/// <summary>Derived recommendations for wizard chip auto-population</summary>
public AudienceRecommendations Recommendations { get; set; } = new();
/// <summary>Human-readable summary strings for the insight bar</summary>
public List<string> Insights { get; set; } = new();
}
public sealed class AudienceRecommendations
{
public List<string> AgeRanges { get; set; } = new();
public List<string> Incomes { get; set; } = new();
public string AgeSkew { get; set; } = "balanced";
public string MarketScope { get; set; } = "local";
}