using System.Collections.Generic;
namespace Keps.WinForms.Models
{
///
/// poll_data 원시 데이터 한 행(투표구 단위)을 표현하는 모델입니다.
///
public sealed class PollingPlaceRecord
{
/// 선거명 또는 연월.
public string ElectionName { get; set; }
/// 시도명.
public string AreaName { get; set; }
/// 선거구명.
public string DistrictName { get; set; }
/// 시군구.
public string SiGunGu { get; set; }
/// 읍면동.
public string EupMyeonDong { get; set; }
/// 투표구 표시명(예: 읍면동 + " 제N투").
public string PollingPlaceName { get; set; }
/// 투표구 번호.
public string PollingPlaceNo { get; set; }
/// 계산된 군집 값.
public int ClusterValue { get; set; }
/// 유권자수.
public int EligibleVoterCount { get; set; }
/// 선거인수.
public int ElectorateCount { get; set; }
/// 투표인수.
public int VoteCount { get; set; }
/// 후보자별 득표수 합계.
public int TotalCandidateVoteCount { get; set; }
/// 중복 투표소 여부 플래그.
public string DuplicateFlag { get; set; }
/// 투표소 건물명.
public string BuildingName { get; set; }
/// 주소(첫 줄).
public string Address1 { get; set; }
/// 관할구역/세부지역.
public string AreaDetail { get; set; }
/// 비고/기타 메모.
public string Note { get; set; }
/// 후보자별 득표수.
public Dictionary CandidateVotes { get; set; }
/// 후보자별 득표율(%)
public Dictionary CandidateRatios { get; set; }
///
/// 지정된 정렬 키에 대한 값을 반환합니다.
///
/// 정렬 키(예: "투표인수" 또는 cand_ratio_*).
/// 정렬용 수치 값.
public decimal GetSortValue(string sortKey)
{
if (string.IsNullOrWhiteSpace(sortKey) || sortKey == "투표인수")
{
return VoteCount;
}
if (CandidateRatios != null && CandidateRatios.ContainsKey(sortKey))
{
return CandidateRatios[sortKey];
}
return 0m;
}
}
}